File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -726,24 +726,40 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
726726 subsetRegexes = subsets . map ( function ( sub ) { return "^" + sub + ".*$" ; } ) ;
727727 subsetRegexes . push ( "^(?!" + subsets . join ( "|" ) + ").*$" ) ;
728728 }
729+ var counter = subsetRegexes . length ;
730+ var errorStatus ;
729731 subsetRegexes . forEach ( function ( subsetRegex , i ) {
730732 tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '' ;
731733 var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
732734 console . log ( cmd ) ;
733- function finish ( ) {
735+ function finish ( status ) {
736+ counter -- ;
737+ // save first error status
738+ if ( status !== undefined && errorStatus === undefined ) {
739+ errorStatus = status ;
740+ }
741+
734742 deleteTemporaryProjectOutput ( ) ;
735- complete ( ) ;
743+ if ( counter !== 0 || errorStatus === undefined ) {
744+ // run linter when last worker is finished
745+ if ( lintFlag && counter === 0 ) {
746+ var lint = jake . Task [ 'lint' ] ;
747+ lint . addListener ( 'complete' , function ( ) {
748+ complete ( ) ;
749+ } ) ;
750+ lint . invoke ( ) ;
751+ }
752+ complete ( ) ;
753+ }
754+ else {
755+ fail ( "Process exited with code " + status ) ;
756+ }
736757 }
737758 exec ( cmd , function ( ) {
738- if ( lintFlag && i === 0 ) {
739- var lint = jake . Task [ 'lint' ] ;
740- lint . addListener ( 'complete' , function ( ) {
741- complete ( ) ;
742- } ) ;
743- lint . invoke ( ) ;
744- }
745759 finish ( ) ;
746- } , finish ) ;
760+ } , function ( e , status ) {
761+ finish ( status ) ;
762+ } ) ;
747763 } ) ;
748764}
749765
You can’t perform that action at this time.
0 commit comments