0

I have encountered an issue where I am trying to perform mutation testing on my util classes in my react project using this http://stryker-mutator.github.io/ library. However I get the following errors,

[2017-05-17 16:29:04.321] [ERROR] CoverageInstrumenterStream - Error while instrumenting file "path/to/something.js", error was: Error: Line 29: Unexpected token
[2017-05-17 16:29:05.586] [ERROR] Stryker - One or more tests errored in the initial test run:
    SyntaxError: Unexpected token import

seems the library cant identify the import and the export statements in the file.

I tried to search a fix for this but came up short. It will be grately appreciated if you experts can help me on a workaround, or a solution via grunt where I could change the import and exports to require and module.exports without harming the code format of the logic.

Thanks alot

Hasitha Shan
  • 2,900
  • 6
  • 42
  • 83

2 Answers2

2

I have worked with stryker framework. In our project, we were using browserify for importing files. So if you are using the same, you have to provide 'browserify' in framework array in stryker.conf.js.

Ankit Shah
  • 51
  • 5
1

The problem is that this version of Stryker work with ES5 by default.

There are a new version of Stryker which support ES6 (https://www.npmjs.com/package/stryker-javascript-mutator).

caballerog
  • 2,679
  • 1
  • 19
  • 32