-
Notifications
You must be signed in to change notification settings - Fork 112
Description
Logs and screenshots
Please provide debug logs by running Cypress from the terminal with DEBUG=code-coverage environment variable set. See the Debugging section of the README file.

Versions
- What is this plugin's version? If this is NOT the latest released version, can you try the latest version, please?
"@cypress/code-coverage": "3.12.45",
-
If the plugin worked before in version X but stopped after upgrading to version Y, please try the released versions between X and Y to see where the breaking change was.
Appears to be working before this change. 1cf7df2
Version 3.12.32 -
What is the Cypress version?
"cypress": "12.14.0", -
What is your operating system?
Windows 11 -
What is the shell?
N/A -
What is the Node version?
18.19.1 -
What is the NPM version?
10.2.4 -
How do you instrument your application? Cypress does not instrument web application code, so you must do it yourself.
I am using nyc -
When running tests, if you open the web application in a regular browser and open DevTools, do you see
window.__coverage__object? Can you paste a screenshot?
Tests fail to run because of the error. But I seewindow.__coverage__when running my server outside of cypress.
-
Is there a
.nyc_outputfolder? Is there a.nyc_output/out.jsonfile? Is it empty? Can you paste at least part of it so we can see the keys and file paths?
There is no output folder. Error prevents tests from running. -
Do you have any custom NYC settings in
package.json(nycobject) or in other NYC config files?
No -
Do you run Cypress tests in a Docker container?
No
Describe the bug
support.js throws an error on const applicationSourceCoverage = win?.__coverage__. I am using a custom webpack loader. So this could simply be an issue with @jsdevtools/coverage-istanbul-loader not understanding how to handle "optional chaining operators". But I could be wrong. Webpack loaders are sort of new to me. Possibly I just need to use something besides @jsdevtools/coverage-istanbul-loader?
Also, I found this same issue reported on stackoverflow.
https://stackoverflow.com/questions/78483412/cypress-code-coverage-unexpected-token-win-coverage/78880561#78880561
coverage.webpack.js
module.exports = {
module: {
rules: [
{
test: /\.(js|ts)$/,
loader: '@jsdevtools/coverage-istanbul-loader',
options: { esModules: true },
enforce: 'post',
include: require('path').join(__dirname, '..', 'src'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/,
/(ngfactory|ngstyle)\.js/
]
}
]
}
};
Link to the repo
I currently have no repo. This is currently setup on an internal project. I can maybe make a repo if necessary.