cypress-io / cypress-io/code-coverage

Cypress Code Coverage cypress.config.ts file - setupNodeEvents(on, config) error required is not defined

Open
#715 9 comments 7 reactions 0 assignees View on GitHub
documentation
Dominant language
TypeScript
Stars
445
Forks
115
PR merge metrics
No merged PRs in 30d

Description

I wanted to set up cypress code coverage on my sveltekit but I get an error in my cypress.config.ts file -
```js
setupNodeEvents(on, config) {

import { defineConfig } from 'cypress'

export default defineConfig({

e2e: {
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config)
return config
},
},
})
```
and when I run cypress test I get error :Your configFile threw an error from: C:\Code\me-ui\cypress.config.ts
The error was thrown while executing your e2e.setupNodeEvents() function:
ReferenceError: require is not defined
at setupNodeEvents (file:///C:/Code/me-ui/cypress.config.ts:10:13)

Anyone experienced this before?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.