File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -104,4 +104,6 @@ if (argv.parser) {
104
104
}
105
105
106
106
var runner = require ( './runner-core' ) ( modulesToRun ) ;
107
- require ( './runner-display' ) ( runner , argv ) ;
107
+ require ( './runner-display' ) ( runner , argv , function ( err ) {
108
+ process . exit ( err ? 1 : 0 ) ;
109
+ } ) ;
Original file line number Diff line number Diff line change @@ -147,19 +147,22 @@ var runnerHandlers = {
147
147
}
148
148
console . log ( 'TOTALS: %s failed; %s success' , ratio , percent ) ;
149
149
console . log ( 'TIME: %dms' , duration ) ;
150
-
151
- if ( passedTests !== totalTests ) {
152
- process . exit ( 1 ) ;
153
- }
154
-
155
150
}
156
151
} ;
157
152
158
- module . exports = function ( runner , args ) {
153
+ module . exports = function ( runner , args , callback ) {
159
154
argv = args ;
160
155
start = new Date ( ) . getTime ( ) ;
161
156
162
157
Object . keys ( runnerHandlers ) . forEach ( function ( event ) {
163
158
runner . on ( event , runnerHandlers [ event ] ) ;
164
159
} ) ;
160
+
161
+ runner . on ( 'done' , function ( ) {
162
+ if ( passedTests !== totalTests ) {
163
+ callback ( new Error ( failedTests + ' failures' ) ) ;
164
+ } else {
165
+ callback ( ) ;
166
+ }
167
+ } ) ;
165
168
} ;
You can’t perform that action at this time.
0 commit comments