Skip to content

Commit aa53b9e

Browse files
committed
Merge pull request microsoft#8804 from Microsoft/fixTestRun
do not swallow test execution errors (uncovers recent build break)
2 parents d7e30f0 + c4b517c commit aa53b9e

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

Jakefile.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)