Skip to content

Commit

Permalink
Scope loading behaviour instead of using early return
Browse files Browse the repository at this point in the history
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 <jappelman@xebia.com>
Closes #1787
  • Loading branch information
aryeguy authored and Joshua Appelman committed Jul 8, 2015
1 parent d29f7e9 commit 952dca7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/_mocha
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
Expand Down

0 comments on commit 952dca7

Please sign in to comment.