Mocha Webstorm Config with Babel / --harmony

Here's the screen cast showing my issue also: https://youtu.be/0HRc3QpfUHM

I've been running my mocha tests via gulp tasks and terminal up till now in Webstorm.  I have Webstorm v.10.0.4.

So here's what that looks like

 
require("harmonize")();
 

 
gulp.task('mocha-bdd-features', function() {
    
process.env.PORT = 8001;
    return gulp.src([
config.test.src.bdd.features], { read: false })
        .pipe(
mocha({
            compilers: {
                js:
babel
            },
            reporter:
config.test.mocha.reporter,
            ui: 'bdd'
        }))
        .on('error',
gutil.log);
});
  
Note that to put the --harmony flag in so that my entire codebase is aware of it I'm using node-harmonize which enables Node's harmony flag programmatically.
  
so at the top of my gulp file I have require("harmonize")();

   
then when run, you see the results in terminal:
Screen Shot 2015-08-09 at 4.53.25 PM.png
  
So now I figured why not use a mocha config so I can use the nice Test Runner Built-into Mocha.
  
This was my first attempt to create a mocha test configuration.
  
I created a new configuration and here's how it's set so far:
  
Screen Shot 2015-08-09 at 4.56.22 PM.png
 
Problem is when I run it, the ES6 transpiler isn't being wired up during compile-time and so any ES6 code mocha tests run across, blows up.  I tried adding the flag --compilers js:babel/register but that didn't help the situation.
  
Screen Shot 2015-08-09 at 5.16.36 PM.png
  
So again through running tests via a gulp task everything is fine and dandy because I'm uisng that harmonize module through gulp.  So how do I get this happy with webstorm moch and ES6?
   
2 comments
Comment actions Permalink

Hmm... Did you try adding '--harmony' flag to 'Node options' in your Mocha run configuration? Note that you need using node 0.11 or higher to get it working. But actually specifying '--compilers js:babel/register' should do the thing anyway...

0
Comment actions Permalink

Changing to '--compilers js:babel-register' started working for me. Noe: - instead of /.

0

Please sign in to leave a comment.