@@ -7,7 +7,7 @@ import { delay } from '../src/util';
77import { expect } from 'chai' ;
88
99describe ( 'Integration test' , function ( ) {
10- this . timeout ( 15000 ) ;
10+ this . timeout ( 30000 ) ;
1111
1212 let serverProcess : ChildProcess ;
1313 let stdout = '' ;
@@ -20,17 +20,19 @@ describe('Integration test', function () {
2020 stdout = "" ;
2121 stderr = "" ;
2222
23- serverProcess . stdout . on ( 'data' , ( d ) => {
24- stdout = stdout + d . toString ( ) ;
25- console . log ( d . toString ( ) ) ;
23+ return new Promise ( ( resolve , reject ) => {
24+ serverProcess . stdout . on ( 'data' , ( d ) => {
25+ resolve ( ) ;
26+ stdout = stdout + d . toString ( ) ;
27+ console . log ( d . toString ( ) ) ;
28+ } ) ;
29+
30+ serverProcess . stderr . on ( 'data' , ( d ) => {
31+ reject ( ) ;
32+ stderr = stderr + d . toString ( ) ;
33+ console . warn ( d . toString ( ) ) ;
34+ } ) ;
2635 } ) ;
27- serverProcess . stderr . on ( 'data' , ( d ) => {
28- stderr = stderr + d . toString ( ) ;
29- console . warn ( d . toString ( ) ) ;
30- } ) ;
31-
32- // In CI, this takes much longer than locally, so wait a little.
33- await delay ( process . env . CI ? 10000 : 2000 ) ;
3436 } ) ;
3537
3638 afterEach ( ( ) => {
@@ -39,6 +41,7 @@ describe('Integration test', function () {
3941 } ) ;
4042
4143 it ( 'starts and stops successfully' , async ( ) => {
44+ await delay ( 500 ) ;
4245 serverProcess . kill ( ) ;
4346
4447 expect ( stderr ) . to . equal ( '' ) ;
0 commit comments