Babel unexpected token import when running mocha tests

前端 未结 17 1533
Happy的楠姐
Happy的楠姐 2020-11-27 14:40

The solutions offered in other related questions, such as including the proper presets (es2015) in .babelrc, are already implemented in my project.

I have two projec

17条回答
  •  醉酒成梦
    2020-11-27 15:03

    --compilers is deprecated.

    My simple solution:

    npm install --save-dev babel-core
    

    And in the package.json add your test script like this:

      "scripts": {
        "test": "mocha --require babel-core/register ./test/**/*.js -r ./test-setup.js"
      },
    

提交回复
热议问题