0

I'm getting an error saying (function (exports, require, module, __filename, __dirname) { export const DISPLAY_FORMAT = 'L'; SyntaxError: Unexpected token export when I run my tests with this command: NODE_ENV=test mocha --compilers js:babel-core/register --require ./react_redux/test/test_helper.js './react_redux/*/*/test*/*.@(js|jsx)'.

This seems to be a problem with the react-dates package as this is the only time I am getting this error.

Using Mocha, Enzyme and Chai for testing.

I have this in my package.json:

"babel": {
    "presets": [
      "es2015",
      "react"
    ]
  }

and this in my .babelrc:

{
    "presets": ["es2015", "react"],
    "plugins": ["transform-object-rest-spread"]
}

Some relevant versions:

"react": "^16.2.0",
"react-dates": "^17.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"chai": "^3.5.0",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"mocha": "^5.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
mrseanbaines
  • 823
  • 2
  • 12
  • 25

0 Answers0