nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Can't run tests since imported node modules aren't transpiled

Open fc opened this issue 5 years ago • 2 comments

If I do this in a test:

import fetchMock from "fetch-mock";

It will generate this error:

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  {
    "message": "SyntaxError: Unexpected token 'const'\nat webpack:///node_modules/tr46/index.js:3 <- tests/index-test.js:69813",
    "str": "SyntaxError: Unexpected token 'const'\nat webpack:///node_modules/tr46/index.js:3 <- tests/index-test.js:69813"
  }

fc avatar Oct 19 '18 18:10 fc

If I change the browser to ChromeHeadless in nwb.config.js that solves it and maybe solves it for someone else...

  karma: {
    browsers: ["ChromeHeadless"]
  },

fc avatar Oct 19 '18 19:10 fc

Keeping this open since I am still running into issues and it seems like this should be configurable but not clear how to get it to work ?...

fc avatar Oct 19 '18 22:10 fc