File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -32,23 +32,16 @@ function createExitHarness (conf) {
32
32
stream . on ( 'end' , function ( ) { ended = true } ) ;
33
33
34
34
if ( conf . exit === false ) return harness ;
35
- if ( ! process . exit || ! process . _getActiveHandles ) return harness ;
35
+ if ( ! canEmitExit || ! canExit ) return harness ;
36
36
37
- var iv = setInterval ( function ( ) {
38
- if ( process . _getActiveHandles ( ) . length > 1 ) return ;
39
-
40
- clearInterval ( iv ) ;
41
- setTimeout ( function ( ) {
42
- if ( ended ) return ;
37
+ process . on ( 'exit' , function ( code ) {
38
+ if ( ! ended ) {
43
39
for ( var i = 0 ; i < harness . _tests . length ; i ++ ) {
44
40
var t = harness . _tests [ i ] ;
45
41
t . _exit ( ) ;
46
42
}
47
- } , 100 ) ;
48
-
49
- setTimeout ( function ( ) {
50
- process . exit ( harness . _exitCode ) ;
51
- } , 105 ) ;
43
+ }
44
+ process . exit ( code || harness . _exitCode ) ;
52
45
} ) ;
53
46
return harness ;
54
47
}
You can’t perform that action at this time.
0 commit comments