@@ -60,6 +60,34 @@ test('exit after tests are finished', function (t) {
60
60
} ) ;
61
61
} ) ;
62
62
63
+ test ( 'rejects promise if the process exits with a non-zero code' , function ( t ) {
64
+ return fork ( fixture ( 'immediate-3-exit.js' ) )
65
+ . catch ( function ( err ) {
66
+ t . is ( err . name , 'AvaError' ) ;
67
+ t . is ( err . message , path . join ( 'test' , 'fixture' , 'immediate-3-exit.js' ) + ' exited with a non-zero exit code: 3' ) ;
68
+ } ) ;
69
+ } ) ;
70
+
71
+ test ( 'rejects promise if the process exits without results' , function ( t ) {
72
+ return fork ( fixture ( 'immediate-0-exit.js' ) )
73
+ . catch ( function ( err ) {
74
+ t . is ( err . name , 'AvaError' ) ;
75
+ t . is ( err . message , 'Test results were not received from ' + path . join ( 'test' , 'fixture' , 'immediate-0-exit.js' ) ) ;
76
+ } ) ;
77
+ } ) ;
78
+
79
+ test ( 'rejects promise if the process is killed' , function ( t ) {
80
+ var forked = fork ( fixture ( 'es2015.js' ) ) ;
81
+ return forked
82
+ . on ( 'stats' , function ( ) {
83
+ this . kill ( 'SIGKILL' ) ;
84
+ } )
85
+ . catch ( function ( err ) {
86
+ t . is ( err . name , 'AvaError' ) ;
87
+ t . is ( err . message , path . join ( 'test' , 'fixture' , 'es2015.js' ) + ' exited due to SIGKILL' ) ;
88
+ } ) ;
89
+ } ) ;
90
+
63
91
test ( 'fake timers do not break duration' , function ( t ) {
64
92
fork ( fixture ( 'fake-timers.js' ) )
65
93
. run ( { } )
0 commit comments