Skip to content

Commit 5b4e964

Browse files
committed
do not swallow test execution errors
1 parent 7173fa8 commit 5b4e964

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

Jakefile.js

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -726,24 +726,39 @@ 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+
if (lintFlag) {
745+
var lint = jake.Task['lint'];
746+
lint.addListener('complete', function () {
747+
complete();
748+
});
749+
lint.invoke();
750+
}
751+
complete();
752+
}
753+
else {
754+
fail("Process exited with code " + status);
755+
}
736756
}
737757
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-
}
745758
finish();
746-
}, finish);
759+
}, function(e, status) {
760+
finish(status);
761+
});
747762
});
748763
}
749764

0 commit comments

Comments
 (0)