How to get it running with babel?
Opened this issue · 8 comments
I use ES2015 within my tests so I use it with babel as transpiler. With mocha this works via "--require=babel/register" or with "--compilers js:babel/register" but since mocha runs within Atom, it seems it can not load the local npm package.
There might be a problem with how the require is working. If I recall correctly, it was a copy-paste job from mocha... plugin should support these options, but I never really tried it so there might be unexpected problems running within the context of atom. I'll take a look later today once I'm home from work.
Thanks for the report.
Two bugs here,
- passing the equals sign a la
--require=babel/register
made it break - the require was running from the directory of the plugin, not the project directory.
I've fixed both of these, should be pushed up with 1.1.7
Thanks, but I still get the following error "Uncaught Error: cannot resolve path (or pattern) '--watch-extensions'"
Possibly cause I have an --watch-extensions=js,es6 in my mocha.opts
Hmm it seems not only this option is the problem. My mocha.opts looks like this:
--recursive
--watch-extensions=js,es6
--require=babel-register
--require=babel-polyfill
--reporter=spec
--bail
The window only opens when I delete all except the require tag but then it detects no test.
I see... man, I'm bad at this command line parsing stuff. I had watch-extensions in there but commented out -- it doesn't pick it up as an argument then assumes it's a path. Fixed in 1.1.9
Hmm that still dont work. Even when I try your example from readme I get:
"Uncaught Error: Unexpected token ..."
mocha-runner/lib/runner.js:47
My current mocha.opts
--require=babel-register
--require=babel-polyfill
--slow 500
--no-timeouts
--recursive
test/*_/_Test.js
Interesting. Do you have a sample project I can clone to try to recreate this?
Have you tried adding --compilers js:babel-core/register
to your mocha.opts?