-
-
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
nyc --all option reporting wrong coverage results if all files are instrumented #1372
Comments
Neither |
@coreyfarrell thanks for your valuable input. Could you please recommend which loader I can use in the webpack and support Istanbul libraries upto date ? |
I'm sorry I don't use webpack so I can't make direct recommendations. If it's just a matter of getting the code instrumented then I assume webpack has a way to run babel 7, in that case the latest babel-plugin-istanbul is the best way to get coverage counters into your code. |
Ok @coreyfarrell . I will try this approach and see how it works with webpack builder and cypress test runner. And I will share my results 🙂 |
hi @coreyfarrell , i tried what you suggested to instrument the source code using babel-plugin-istanbul and if i specify 1)nyc with --all option
i need help to figure out this issue, if anything i have missed in configuration / code part. Here is an example repository https://github.com/kishok/ticket-coupon |
hi @coreyfarrell, any suggestions please on the above query. How to solve this issue? |
HI @kishok , were you able to solve this? I run into the same issue with a similar setup: https://github.com/toaditoad/code-coverage-mwe |
hi @toaditoad I didn't check that due to some reasons but you can try explore why the nyc output json have no source instrumentation code parts if we used --all option by deep dive in their source code. This is required if you want full code coverage report. I think community is not very much active currently ! |
Expected Behavior
nyc should show correct coverage results of all instrumented files with --all option.
For example, if i have a.js and b.js in my application, unit tests only load a.js the total coverage could show as some percentage based on functionalities tested. If any of those files remain uncovered they will be factored into the report with a default of 0% coverage.
Observed Behavior
This was the result i am getting with all option enabled, shows no coverage results for any files even it failed for the files touched by my test suite shown below:
If i disabled the --all option, it shows the coverage report for the files touched by test suite as shown below:
Troubleshooting steps
cache: false
in my nyc configEnvironment Information
"istanbul-instrumenter-loader": "^3.0.1",
"nyc": "^15.1.0",
i am using cypress test runner and istanbul-instrumenter-loader to instrument the source code with this configuration in webpack:
The text was updated successfully, but these errors were encountered: