Running ES6 Specs With Mocha
Last updated
Was this helpful?
Last updated
Was this helpful?
If your JavaScript specs contain ES6 syntax, , by default, will not be able to interpret and run them. In order to run them with Mocha, you will need to tell Mocha to use something like to compile them. The --compile
flag can be used to point Mocha to the babel-core/register
package.
If you already have a test command specified in your package.json
file, you can update it with the --compile
portion of the above command.
This all assumes you've already setup your project with Babel and Babel presets.