From cc0295d93d05484af81d0291a6fb1e9642312e6f Mon Sep 17 00:00:00 2001 From: Guy Arye Date: Mon, 6 Jul 2015 14:57:03 +0300 Subject: [PATCH 1/2] Scope loading behaviour instead of using early return Fails under babel_node node_modules/mocha/bin/_mocha Transformation error; return original code { [SyntaxError: node_modules/mocha/bin/_mocha: 'return' outside of function (392:2)] pos: 9902, loc: { line: 392, column: 2 }, raisedAt: 9908, _babel: true, codeFrame: ' 390 | });\n 391 | \n> 392 | return;\n | ^\n 393 | }\n 394 | \n 395 | // load' } based on advice from @oakfang --- bin/_mocha | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/_mocha b/bin/_mocha index 63ab9a42e5..8ee8c9972c 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -392,15 +392,15 @@ if (program.watch) { rerun(); } }); - - return; -} + +} else { // load -mocha.files = files; -runner = mocha.run(program.exit ? exit : exitLater); - + mocha.files = files; + runner = mocha.run(program.exit ? exit : exitLater); + +} function exitLater(code) { process.on('exit', function() { process.exit(code) }) } From d95d64a133098265e530467187de8094cd281ff2 Mon Sep 17 00:00:00 2001 From: Guy Arye Date: Tue, 7 Jul 2015 11:31:35 +0300 Subject: [PATCH 2/2] Added newline after } --- bin/_mocha | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/_mocha b/bin/_mocha index 8ee8c9972c..b5e50f22ee 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -401,6 +401,7 @@ if (program.watch) { runner = mocha.run(program.exit ? exit : exitLater); } + function exitLater(code) { process.on('exit', function() { process.exit(code) }) }