Skip to content

Commit 7d31bcf

Browse files
author
Andy Hanson
committed
Add option to bail out of jake runtests when one test fails
1 parent 3dca09b commit 7d31bcf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Jakefile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,14 @@ function runConsoleTests(defaultReporter, runInParallel) {
754754
colors = process.env.colors || process.env.color;
755755
colors = colors ? ' --no-colors ' : ' --colors ';
756756
reporter = process.env.reporter || process.env.r || defaultReporter;
757+
var bail = (process.env.bail || process.env.b) ? "--bail" : "";
757758
var lintFlag = process.env.lint !== 'false';
758759

759760
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
760761
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
761762
if(!runInParallel) {
762763
tests = tests ? ' -g "' + tests + '"' : '';
763-
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
764+
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run;
764765
console.log(cmd);
765766

766767
var savedNodeEnv = process.env.NODE_ENV;
@@ -825,7 +826,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
825826
runConsoleTests('min', /*runInParallel*/ true);
826827
}, {async: true});
827828

828-
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true.");
829+
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true bail=false.");
829830
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
830831
runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false);
831832
}, {async: true});

0 commit comments

Comments
 (0)