-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating coverage produces errors when testing code that uses ES 6 default/override pattern #264
Comments
@patrickarlt I got the ava tests passing with some configuration options and fixing some typos in the I recommend taking a look at ava's instructions for Let me know if that helps or not :) |
There are various issues with ES6 code and Istanbul, the library nyc uses to collect coverage data and prepare the reports: #215, #198, #239. The tl;dr is that Istanbul doesn't support the new syntax, so you need to transpile to ES5, which is @JaKXz's suggestion. Unfortunately that doesn't always work, since nyc now needs source maps in order to get the correct data. Source maps aren't always accurate, and then the resulting coverage data may be internally inconsistent, leading to crashes when generating reports. There's a few things we can do to reduce the incidence of crashes (namely to throw away inconsistent data), but then there'll be less coverage. The better approach would be to switch to an instrumenter that understands ES6. I've been planning to work on that but haven't had the time. In the meantime try transpiling to ES5 and hope for the best. |
@patrickarlt give this a spin: we've released better support for ES6/ES6 coverage using the |
I'm testing code that uses the ES 6 default override pattern in some code I am testing. When testing regularly with node-tap (which bundles nyc) or ava (which recommends nyc) the tests pass. But when I use nyc to generate coverage reports there are errors that are not present when not generating coverage.
I've created a minimal reproduction of this issue in this gist. which shows Node 6.2.0 being able to run the tests without coverage (
tap node-tap-test.js
andava ava-test.js
) and passing but when running with coverage (tap test-node-tap.js --coverage-report=text
andnyc ava ava-test.js
) the tests fail and the parameters padded to thesay(options)
function end up being undefined.The text was updated successfully, but these errors were encountered: