How to use ES6 syntax with zuul test framework
daveashworth opened this issue · comments
Using mocha as my test framework, in my mocha.opts
file I have the following option to tell mocha to use babel as the compiler:
--compilers js:babel-core/register
In my test file, my first line is:
import React from "react";
And when I run zuul with this test, I see the following output in the console:
import React from "react";
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
Can someone please point me to where I setup zuul to use babel to make this work properly?
it looks like you can do this for browserify, but our projects use webpack...
browserify:
- transform:
name: babelify
Is there another way?
@daveashworth not sure zuul is picking mocha.opts, you should ensure it's reading it first
@vvo: is zuul supposed to pick up mocha.opts
? That would be nice if so. I didn't mean to imply that I thought it would, only showing that for mocha there is an option to specify compilers. I was hoping there was the same for zuul. I'm currently using zuul-builder-webpack
to achieve similar results, but was hoping for something built into zuul.
It seems it's not pickup up mocha.opts indeed. https://github.com/defunctzombie/zuul/blob/1a3391cfe7699a710cfbf4ad61c0221e3fb331d8/frameworks/mocha/client.js