$ mocha --compilers babel/register
/usr/local/lib/node_modules/mocha/bin/_mocha:302
if (mod[0] == '.') mod = join(process.cwd(), mod);
^
TypeError: Cannot read property '0' of undefined
at /usr/local/lib/node_modules/mocha/bin/_mocha:302:10
at Array.forEach (native)
at Object.
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
The error is legit (correct usage of --compilers is extension:require).
We should probably validate that usage and spit out a more meaningful error message, though.
what can i do with this error?
use mocha --require babel or mocha --compilers babel/register--require ./test/user.js
or any shell others?
i still failed to use --require
I think your original attempt just needs "js:" before the compiler name: --compilers js:babel/register. Let me know if that doesn't work.
I successed with this:
http://jamesknelson.com/testing-in-es6-with-mocha-and-babel-6/
before,i use babel but failed,then use babel-core successed
thanks
--compilers was removed in v6.0.0