question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not compatible with @cypress/code-coverage

See original GitHub issue

When I add following in cypress/plugins/index.js

module.exports = (on, config) => {
  on('task', require('@cypress/code-coverage/task'))
}

It gives compilation error “ParseError: Unexpected token”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
ghostcommented, Jan 21, 2020

Aaaaaand, I need to find something solid to bang my head against :p Read and followed these instructions without thinking: https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin so I ended up with:

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
    on('file:preprocessor', cucumber())
}

module.exports = (on, config) => {
    on('task', require('@cypress/code-coverage/task'))
}

instead of something sensible like:

const cucumber = require('cypress-cucumber-preprocessor').default
const coverage = require('@cypress/code-coverage/task')

module.exports = (on, config) => {
    on('file:preprocessor', cucumber())
    on('task', coverage())
}

in my support/index.js. Sorry for the noise.

0reactions
edimitchelcommented, Aug 7, 2020

I’ve tried with require('cypress-react-unit-test/plugins/load-webpack')(on, config); and it’s doesn’t work with. Yes this import is for Unit Testing but it do all the work for adding code coverage that we need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Coverage - Cypress Documentation
To handle code coverage collected during each test, we created a @cypress/code-coverage Cypress plugin. It merges coverage from each test and saves the...
Read more >
@cypress/code-coverage - npm
Saves the code coverage collected during Cypress tests. Latest version: 3.10.0, ... This plugin DOES NOT instrument your code.
Read more >
Not compatible with @cypress/code-coverage #198 - GitHub
I've tried with require('cypress-react-unit-test/plugins/load-webpack')(on, config); and it's doesn't work with. Yes this import is for Unit ...
Read more >
Understanding code coverage in Cypress - Filip Hric
Code coverage is one of those few things that doesn't come right out of the box with Cypress. To set up code coverage,...
Read more >
Cypress — code coverage reports for unit tests | by Kristijan
One of most common test reports used is code coverage reports. And while Cypress does support them, setting them up can be a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found