-
Notifications
You must be signed in to change notification settings - Fork 110
nyc out.json is empty #78
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
Comments
We have the same problem here :( |
same here. |
Also experiencing this issue |
same here |
Mine is also empty, followed the guide https://docs.cypress.io/guides/tooling/code-coverage.htm step by step until fullstack. |
same here |
I fixed this issue on our project (we using TypeScript) re-installing the dependencies and putting these codes: package.json "scripts": {
"cy:run:report": "nyc --reporter=html cypress run"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "0.1.3",
"babel-plugin-istanbul": "5.2.0",
"source-map-support": "0.5.16",
"@cypress/code-coverage": "1.10.1",
"istanbul-lib-coverage": "2.0.5",
"nyc": "14.1.1"
},
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"extension": [
".tsx"
],
"include": [
"src/**/*.tsx"
],
"exclude": [
"cypress/",
"assets/",
"test/"
],
"all": true
} .babelrc
added in plugins/index.js on('task', require('@cypress/code-coverage/task')) and support/index.ts import '@cypress/code-coverage/support' It's works for now, but I can improve these. |
Can I please have a reproducible repo with the problem? Otherwise I have no idea what the possible problems could be |
@bahmutov here's a repo where you can reproduce the issue. However I run the test, the nyc/out.json remains empty. Feel free to contribute on the repo if you feel so. Also, let me know if there's anything else I can do. |
Oh god, in my case I missed a babel configuration thing... I forgot to add "plugins": ["transform-class-properties", "istanbul"] to my babel config |
Dear Cypress team, any update on this one? |
Same issue here |
Same issue here... + |
Same issue ! .nyc-output/out.json is always empty no matter what settings you keep and do! Tried everything there is on internet! Either its an issue with code-coverage or its the problem with nyc!Cant really figure whats causing this issue ! (Also we are not using babel) |
Me and my team are experiencing the same here We have tried but still did not find what is it for 😅 😬 |
Same problem. |
@elaco77 I have copied your example - you are not instrumenting your code, once you follow https://github.com/cypress-io/instrument-cra or https://github.com/bahmutov/testing-react#installation instructions your source code will be instrumented on the fly, and code coverage will be saved |
I think what got lost in README is that this plugin DOES NOT instrument your application's code - you have to do this. I added a strong note in https://github.com/cypress-io/code-coverage#instrument-your-application with examples. There are many examples linked from the readme https://github.com/cypress-io/code-coverage#examples to copy instrumentation, so I will close this issue for now. If you still are experiencing an empty coverage object, even if the |
I'm facing a problem where the window.coverage is always coming "undefined" even after following all the Cypress code coverage documentation steps with various instrumentation options mentioned... and when starting my server with the cmd
I get the following error EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' Appreciate your help on this @bahmutov |
The issue for me was during production build mode, I had to force my plugin to do instrumentation (vite-plugin-istanbul + forceBuildInstrumentation option). |
how come? i am not able to use code coverage with vite |
Thanks, @bahmutov for your valuable comment 🙌 First, I tried everything as per the cypress code coverage doc Then, I installed the @cypress/instrument-cra package as @bahmutov mentioned in his comment. I made a lot of changes to multiple files. I hope the following package, and file information will help you all to debug your issues. cypress/support/commands.js cypress.config.js:
.babelrc:
you can also use
It should be @babel/transform-class-properties package.json: package.json I hope this solution will work for everyone! 🙏 |
vue/node js project running with cypress tests, trying to add coverage
the
nyc_output
folder is there also theprocessinto
folderThe
out.json
file is either empty or not created, depending on how i play with the setting filesI also see in the cypress run that the after all task - covergereport runs, but the after each task - combine coverge does not run
my plugins index file has the
my babel
my command line
my json has
what am i missing?
The text was updated successfully, but these errors were encountered: