cypress-documentation icon indicating copy to clipboard operation
cypress-documentation copied to clipboard

Correct code coverage setup example

Open cnotv opened this issue 3 years ago • 3 comments

Proposed configuration returns Cypress not defined in a real use case.

const { defineConfig } = require('cypress')

module.exports = defineConfig({
  // setupNodeEvents can be defined in either
  // the e2e or component configuration
  e2e: {
    setupNodeEvents(on, config) {
      require('@cypress/code-coverage/task')(on, config)
      // include any other plugin code...
      
      // It's IMPORTANT to return the config object
      // with any changed environment variables
      return config
    }
  }
})

Using existing configuration from the RealWorldApp seems working though.

import codeCoverageTask from "@cypress/code-coverage/task";
const { defineConfig } = require('cypress')

module.exports = defineConfig({
  // setupNodeEvents can be defined in either
  // the e2e or component configuration
  e2e: {
    setupNodeEvents(on, config) {
      codeCoverageTask(on, config);
      return config;
    },

cnotv avatar Aug 11 '22 16:08 cnotv

Deploy request for cypress-docs pending review.

Visit the deploys page to approve it

Name Link
Latest commit 51eb525781359af1fb96531dddabfe635af24892

netlify[bot] avatar Aug 11 '22 16:08 netlify[bot]

@cnotv is attempting to deploy a commit to the Cypress Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 11 '22 16:08 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 11 '22 16:08 CLAassistant

Hi @cnotv, thanks for the PR. The existing documentation is the correct implementation. Maybe theres another issue going on?

elylucas avatar Aug 15 '22 15:08 elylucas

You are right, the issue was definitely somewhere else, as in the end it works also with the code from the documentation. For some reasons it did not trigger the first time, due existing hidden configurations plus Nuxt.js ignoring Babel instrumentation.

cnotv avatar Aug 23 '22 10:08 cnotv