-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Code coverage ES6 #185
Comments
NYC relies on
I have been told that integrating If you can't wait for istanbul and NYC to release source map support, I recommend trying to fork NYC to use the istanbul source-map branch. If you run into issues combining coverage files checkout |
Interesting. I should of done a bit more research before asking but I was stuck in traffic and I had it in my head. I'll give it a spin and report back. |
There's also https://github.com/SitePen/remap-istanbul. This seems to work for me:
|
@novemberborn With fb98d5d merged where do we stand on this? Can this be closed, or is this a different issue? |
@jamestalmage it's a different issue. Code coverage is computed over the compiled output, so the stats will be wrong and it's hard to see which line in the original code was not covered. The approach I mentioned above works for my project, which uses a watcher to transpile source files and write them to disk, with their source maps. That output is what's tested. It not quite a one-line though and it depends heavily on your project is set up. This isn't an issue with AVA though. |
By which I mean, since AVA isn't responsible for the coverage reports, it's not a bug with the project. Workarounds could be explained (maybe I should do so! 😉) but it's fairly tricky. |
Here's the writeup of my workaround: https://medium.com/@novemberborn/code-coverage-with-babel-istanbul-nyc-83b8c2f1093 |
I think the latest release of nyc now works out the box... (or at least it does for me!) |
@bcoe,
I look forward to your response. Thanks for your time, and for making |
https://github.com/bcoe/nyc/blob/master/index.js#L138 We might find that the
Let me know anything I can do to help you implement this, feel free to point me at any branches that are |
Thanks for the quick response. We will follow up as we move those initiatives along. |
istanbuljs/nyc#65 takes care of that.
This might have to be documented better on nyc's side, I'll look into that. That said, the test files don't need to be instrumented, the source files that are being tested do. It would help though if AVA's documentation could explain the requirements so users don't have to read up on nyc. I'll look into that when things settle with nyc. |
I tried Here's a snippet of my run scripts: "scripts": {
"test": "ava src/test/**/*.js",
"coverage": "nyc npm test"
} I ran
Any chance someone on this thread could assist in some light guidance? I'd be happy to follow up with some |
"scripts": {
- "test": "ava src/test/**/*.js",
+ "test": "nyc --reporter=lcov ava src/test/**/*.js"
- "coverage": "nyc npm test"
} |
@jamestalmage with that change, running
|
have you installed ava locally?
|
Yeah, ava runs just fine by itself. Here is a snippet from my dev deps:
|
Huh,
|
Tried that, no dice.... same error as above.... 😞 Here's the full stack trace:
|
@sparty02 what Node and npm versions are you running? |
@novemberborn |
@sparty02 wait you're on Windows right? nyc's Windows support isn't quite there yet, we'll be tracking progress in istanbuljs/nyc#81. |
@novemberborn Ah, yep, I'm on Windows (at least part time)....that must be it then. I'll watch that issue for updates.... thanks! |
@sparty02 we've added better support for Windows subprocesses in https://github.com/bcoe/nyc/blob/master/CHANGELOG.md It might be worth giving this a shot. If you still run into problems, could you point me at a repo I can test against? |
@sparty02 Did that solve your problem? If no, would you be able to provide something that reproduces it? |
@bcoe @sindresorhus sorry guys, I spaced out on this. I'll give it a shot tomorrow morning and circle back to let you know. |
@bcoe I pushed a sample repo at https://github.com/sparty02/nyc-ava-demo. I stripped it down to almost nothing, and am still hitting the issue, so it definitely seems environmental. Let me know if I can provide any more info! |
@bcoe @sindresorhus Just a heads up that I saw some activity over on nyc that was done in the past few days that appeared to (at least loosely) be related to better spawn support on Windows. Long story short, I just tried my use case again with |
@sparty02 I just set this up on a windows machine and it works but I couldn't use |
Hello,
You guys recommend to use NYC for coverage since it can handle spawned files. However, when testing since I have to transpile it first, it uses the transpiled code to test for coverage.
Is there a way to configure it so that it does not do this and so that it uses the ES6 code?
The text was updated successfully, but these errors were encountered: