From 952dca73d1c24132b0fb8e30e3300b5346f0f1c1 Mon Sep 17 00:00:00 2001 From: Guy Arye Date: Mon, 6 Jul 2015 14:57:03 +0300 Subject: [PATCH] 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 Signed-off-by: Joshua Appelman Closes #1787 --- bin/_mocha | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/_mocha b/bin/_mocha index 63ab9a42e5..1129178b54 100755 --- a/bin/_mocha +++ b/bin/_mocha @@ -393,13 +393,14 @@ if (program.watch) { } }); - 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) })