From 0ea2646aea5817f6d1595e6ae0d356c426f138f0 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 15 May 2017 22:51:23 -0700 Subject: [PATCH] [scripts/mocha] run _mocha script when debugging --- scripts/mocha.js | 3 ++- test/scripts/run_mocha.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/scripts/run_mocha.js diff --git a/scripts/mocha.js b/scripts/mocha.js index 36b9c92a8df3e02..38a977af3e78673 100644 --- a/scripts/mocha.js +++ b/scripts/mocha.js @@ -1 +1,2 @@ -require('mocha/bin/mocha'); +require('../src/optimize/babel/register'); +require('../test/scripts/run_mocha'); diff --git a/test/scripts/run_mocha.js b/test/scripts/run_mocha.js new file mode 100644 index 000000000000000..e5c747e2573d1d6 --- /dev/null +++ b/test/scripts/run_mocha.js @@ -0,0 +1,16 @@ +const debugInBand = process.execArgv.some(arg => { + switch (arg) { + case '--debug': + case '--debug-brk': + case '-d': + case '--inspect': + return true; + } +}); + +if (debugInBand) { + process.argv.push('--no-timeouts'); + require('mocha/bin/_mocha'); +} else { + require('mocha/bin/mocha'); +}