cypress-io / code-coverage

Saves the code coverage collected during Cypress tests
MIT License
432 stars 107 forks source link

support.js throws an error on "const applicationSourceCoverage = win?.__coverage__. #866

Closed krishollenbeck closed 4 hours ago

krishollenbeck commented 1 month ago

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.

image

Versions

"@cypress/code-coverage": "3.12.45",

image

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.

krishollenbeck commented 3 weeks ago

Ran into a similar issue in Cypress today. I'm thinking this could be an issue with Cypress. While investigating further. I came across these issues.

https://github.com/cypress-io/cypress/issues/20753 https://github.com/cypress-io/cypress/issues/16914

cypress-app-bot commented 4 hours ago

:tada: This issue has been resolved in version 3.13.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: