Skip to content

Commit bd520e1

Browse files
committed
Add debug option to runtests
Running `runtests` with `debug` will cause mocha to run in debug mode and break on the first line, enabling one to connect a debugger to the running tests and step through a test at their leisure.
1 parent 2d37a44 commit bd520e1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Jakefile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,10 @@ function deleteTemporaryProjectOutput() {
588588
}
589589

590590
var testTimeout = 20000;
591-
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.");
591+
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true.");
592592
task("runtests", ["tests", builtLocalDirectory], function() {
593593
cleanTestDirs();
594+
var debug = process.env.debug || process.env.d;
594595
host = "mocha"
595596
tests = process.env.test || process.env.tests || process.env.t;
596597
var light = process.env.light || false;
@@ -613,7 +614,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
613614
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
614615
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
615616
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
616-
var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
617+
var cmd = host + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
617618
console.log(cmd);
618619
exec(cmd, deleteTemporaryProjectOutput);
619620
}, {async: true});

0 commit comments

Comments
 (0)