I'm using Mocha to test a react/webpack/babel application that is written in es6 stage-0 syntax, which includes dynamic imports. Webpack compiles it without errors, but mocha throws the following error when reaching a dynamic import syntax:
import('path/to/file').then(...)
^^^^^^
SyntaxError: Unexpected token import
The command that i'm running is:
$ mocha --compilers js:babel-register src/**/*.test.js
And in my .babelrc I have to following:
{
"presets": ["es2015", "react", "stage-0"]
}