I want to import into my test file utility module, which is written in ES6 and exports several things I need. So what I do is
import { module } from 'file'
but it throws the 'SyntaxError: Unexpected token import' error.
I tried to:
- add
require('babel-core/register')
to the top of the nightwatch.conf.js - add
require('babel-register')()
to the top of the nightwatch.conf.js npm i babel-plugin-add-module-exports --save-dev
, and add "add-module-exports" plugin to the .babelrc config filenpm i babel-preset-es2015 --save-dev
, and add es2015 preset to the .babelrc config fileadd
require('babel-core') require('babel-loader') require('babel-plugin-add-module-exports') require('babel-polyfill') require('babel-preset-stage-2') require('babel-preset-es2015')
to the top of the nightwatch.conf.js
All this didn't help. What should I do to make import/export works?