gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 785 forks source link

Transformation error; return original code. Unexpected token ... #904

Closed chuksynaza closed 5 years ago

chuksynaza commented 5 years ago

After trying to merge objects in my code using:

this.config = { ...defaultConfig, ...config };

I get the error:

Transformation error; return original code

Unexpected token ...

And test coverage is not reported for that file. If that line is commented then test coverage is reported and the error goes away.

jcollum-nike commented 5 years ago

Same here. My version is "istanbul": "^0.4.5", (latest non-alpha)

✗ node --version
v8.15.0
chuksynaza commented 5 years ago

This package is now deprecated and doesn't support ES6. Use nyc - instanbul.js.org. It works with the babel-plugin-instanbul and has full class support for ES6.

It is also very easy to setup

$ npm install --save-dev nyc

Then in your package.json

{
  "scripts": {
    "test": "nyc mocha"
  }
}

Happy coding :smile:

jcollum-nike commented 5 years ago

It would be helpful if that deprecation warning was right at the top of the readme -- as in big bold letters -- along with this suggestion for an alternate.

asirihewage commented 3 years ago

Anyway can we get automation coverage using nyc? I know we could get it using Istanbul.

chuksynaza commented 2 years ago

@abejfehr just so I'm not lost, what do you mean by automation coverage?