code-coverage icon indicating copy to clipboard operation
code-coverage copied to clipboard

[cy10] non "cra" react app: "glob pattern string required (current version of @cypress/code-coverage is not supported)"

Open IvoLeist opened this issue 3 years ago • 1 comments

Dear Cypress Devs,

first congratulations to the release of version 10. Looks good :rocket: However, unfortunately the code-coverage plugin is no longer working for us. See error message below

Logs and screenshots "Cypress detected that the current version of @cypress/code-coverage is not supported. Update it to the latest version"

Versions

plugin: > 3.10.0 (tried npm i https://github.com/cypress-io/code-coverage as well) cypress: > 9.7.0 Operating System: Pop!_OS 20.10 x86_64 Shell: zsh 5.8 Node: v16.13.2 NPM: 8.5.5 react": "^16.14.0"

Instrument the code using: "babel-plugin-istanbul": "^6.0.0",

Object.keys(window.__coverage__).length => 51

Is there .nyc_output folder? => NO

custom nyc settings:

"nyc": {
    "report-dir": "cypress/coverage",
    "reporter": [
      "cobertura",
      "json-summary",
      "json",
      "lcov"
    ]
  },

Do you run Cypress tests in a Docker container? => NO

Describe the bug I try to run a any test using the newest code-coverage plugin (3.10.0) with the newest cypress version (10.1.0) but it errors out on the test runner and from the command line with the same error: "Cypress detected that the current version of @cypress/code-coverage is not supported. Update it to the latest version"

Done test:

describe("Test", () => {
  it("test login", () => {
    cy.visit(Cypress.config("baseUrl"));
    cy.screenshot()
  });
});

Below you find my configs:

e2e: {
    setupNodeEvents(on, config) {
      return require('./plugins/index.js')(on, config)
    },
    baseUrl: 'http://localhost:4000',
    experimentalSessionAndOrigin: true,
    specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
  },
/// <reference types="cypress" />
const webpack = require("@cypress/webpack-preprocessor");

/**
 * @type {Cypress.PluginConfig}
 */
module.exports = (on, config) => {

  // does not matter if used webpack or not in both cases the same error
  // const options = {
  //   webpackOptions: require("../../webpack.testing.js"),
  //   watchOptions: {},
  // };
  // on("file:preprocessor", webpack(options));

  require("@cypress/code-coverage/task")(on, config);
  return config;
};

IvoLeist avatar Jun 14 '22 11:06 IvoLeist

Was investigating the issue a little bit more on my own and it looks to me that this version of the plugin (3.10) does not yet support react apps created w/o create-react-app because apps created with cra run as expected like your example: https://github.com/cypress-io/code-coverage/tree/master/test-apps/new-cypress-config/cra-e2e-and-ct

Can someone confirm that non cra react apps are not yet working and if so can give a rough estimate when it will be supported?

Keep up the good work :v:

IvoLeist avatar Jun 16 '22 06:06 IvoLeist