Babel unexpected token import when running mocha tests

前端 未结 17 1503
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 14:56

    I resolved this issue this morning with the following instructions

    Install NPM Modules

    npm install --save-dev @babel/polyfill
    npm install --save-dev @babel/register
    

    package.json:

    "scripts": {
        "test": "mocha --require @babel/register --require @babel/polyfill src/DesktopApplication/Tests",
      }
    

    .babelrc

    {
      "presets": ["@babel/env"]
    }
    

提交回复
热议问题