-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
coverage results for typescript are non-deterministic #1148
Comments
I believe to use CC @JaKXz my knowledge of TS is very limited but I think this might be an issue where the instrumentation for |
mh, actually looking into the config of
IMHO, it would be better and way easier to just replace the documentation about adding this {
"extends": "@istanbuljs/nyc-config-typescript",
...
} by describing to inject the following into the {
"require": [
"ts-node/register",
"source-map-support/register"
],
"cache": false,
"extension": [
".js",
".ts"
],
...
} Adding the |
Each process records coverage to Regarding the usefulness of |
Sometimes the coverage data produced by `nyc --all` is incompatible with the coverage data produced by actual test runs. This is generally due to configuration error but results in inconsistent coverage reports or in some cases causes `nyc report` to crash. The workaround is implemented in istanbul-lib-coverage to drop coverage data associated with `nyc --all` when coverage data from a test run is found. This commit tags the coverage data when appropriate so the coverage merge logic knows what to do. Fixes istanbuljs#1113, istanbuljs#1124, istanbuljs#1148
…#1155) * fix: Drop coverage produced by `nyc --all` for files that were tested Sometimes the coverage data produced by `nyc --all` is incompatible with the coverage data produced by actual test runs. This is generally due to configuration error but results in inconsistent coverage reports or in some cases causes `nyc report` to crash. The workaround is implemented in istanbul-lib-coverage to drop coverage data associated with `nyc --all` when coverage data from a test run is found. This commit tags the coverage data when appropriate so the coverage merge logic knows what to do. Fixes #1113, #1124, #1148
Actually, the issues are coming back for more complex projects. Sadly, I was not able to create a small reproducible sample yet. But as you can see in the attached screenshot below I am getting weird reports even in case of requiring And this is also independent from |
Same exact issue here, but I'm using AVA, not Mocha. Also, my project is open source. It only has one source file with one function and one test against it, so it's a perfect candidate to reproduce the issue on your end. All you have to do is clone jedmao/node-starter and remove the following from the nyc config in package.json: "require": [
"ts-node/register",
"source-map-support/register"
] Run |
@jedmao currently it is not optional to include these |
Just to be clear, are you saying I should keep my configuration the same as it is now and just update nyc to the latest version when it becomes available? |
Yes |
Thanks for filing this bug. I have an app, https://github.com/moribellamy/graytabby. I have the flakiness in 9817052f36cda3862b0bcc001a2e45d0b8aab9f3, and something about one commit later at 4abb5dac9d6ca0e42b1f15ff7298fed9f097ef88 causes it to stop: you can check for the flakiness with this command. the more correct looking coverage has
on the flaky commit, i can get one flake in 4, approximately. on the next commit i haven't gotten a flake in 20 or so coverage runs. |
@moribellamy so, do you think that |
If you need to reproduce the issue:
run this multiple times, output of the grep would differ |
Everyone experiencing this issue please test with |
@coreyfarrell well, with
At least it's always determenistic now, I always get:
Note that if you check
they are both ok. And it's werid that the format of output html is different |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The bug above still persitst |
@akoidan this is not your issue, you are using cypress which is why I reopened #1226 for you. I understand you're frustrated but please consider this issue unrelated to your problem. @Kosta-Github I have not heard from you on this issue in a while, has nyc 15 resolved your issue? |
@coreyfarrell looks like it is working for me right now with |
@Kosta-Github that's great, thanks for the update! |
Link to bug demonstration repository
demo repo: https://github.com/Kosta-Github/ts-nyc-issue
the
typescript
setup described in nyc-config-typescript has been followedExpected Behavior
running one of the 2 provided
test
scripts several times should always result in the same (correct) output/resultObserved Behavior
Sometimes the result looks like this and the generated HTML coverage report looks OK:
And sometimes the result looks like this:
And in this case the generated HTML files contain this error message:
Troubleshooting steps
cache: false
in my nyc configEnvironment Information
The text was updated successfully, but these errors were encountered: