0

In a simple test:

import {JobCountNumber} from "../../api/helpers/JobCountNumber";
describe('JobCountNumber', function() {
  describe('#constructor', function() {
    it('Set with default modes', function() {
      jc = new JobCountNumber();
    });
  });
});

I am receiving an error on running the test through npm test

import {JobCountNumber} from "../../api/helpers/JobCountNumber";
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at X\node_modules\mocha\lib\mocha.js:231:27
    ... lots more

Now I'm not using a transpiler or a anything like it, as I saw that the node version (8.9) I use supports ES2015 almost completely (see here, only tail call optimization is absent).

So why does it show an error here?

I'm really confused, many topics here on stackoverflow have this error, but they are all about babel presets and transpiling the code. - Something I don't do.

oh, the file ../../api/helpers/JobCountNumber.js does exist.

paul23
  • 7,226
  • 9
  • 44
  • 108

0 Answers0