0

I have a problem, when install the cypress webpack with the project installed cypress coverage appears message

An unexpected error occurred

The function exported by the plugins file threw an error.

We invoked the function exported by C:\Users\Hans\proyectos\axovia\govacasa\govacasa\cypress\plugins\index.js, but it threw an error.

Error: Cannot find module '@cypress/code-coverage/task'

before the installation of webpack package,this package working fine.

plugins/index.js

   /**
     * @type {Cypress.PluginConfig}
     */
    // eslint-disable-next-line no-unused-vars
    const injectDevServer = require("@cypress/react/plugins/react-scripts")
    module.exports = (on, config) => {
      // `on` is used to hook into various events Cypress emits
      // `config` is the resolved Cypress config
      injectDevServer(on, config)
      require('@cypress/code-coverage/task')(on,config)
    
    
      return config;
    }
  • Have you installed the `@cypress/code-coverage` package? – agoff Jan 07 '22 at 18:01
  • The error doesn't occur with `https://github.com/bahmutov/cypress-react-component-example` (adding in the code-coverage package). Do you have two `node_modules` folders in the project? – Fody Jan 08 '22 at 01:21
  • I had @cypress/code-coverage installed previusly. But when install the @cypress/react that deconfigure the cypress plugins – Gabriel Hans González Peña Jan 11 '22 at 20:09

0 Answers0