In cypress migration guide they mention that plugin files are no longer supported. They also mention that you need to use >=v3.10 of code-coverage
plugin
I do have correct version installed, and I tried to update cypress.config.ts
to:
import { defineConfig } from "cypress";
export default defineConfig({
video: false,
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
require('@cypress/code-coverage/task')(on, config)
return config
},
},
});
but it doesn't work. What's the correct way? I believe I do have instrumenting working (I'm using @cypress/instrument-cra
and see coverage object) but I don't see generated coverage files and I don't see a reset coverege step in tests
From your description the only step missing is the support file import.
// cypress/support/e2e.js
import '@cypress/code-coverage/support'
I also have a .babelrc
with the following, but I believe you can do without it if just covering e2e tests.
{
"plugins": ["istanbul"]
}
Let me know if that's not it, I will give you step-by-step.