Skip to content

kuceb/cypress-code-coverage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 

Repository files navigation

cypress-code-coverage

A repo to help you with code coverage + cypress

About

the strategy is:

  • instrument your app code so that coverage is generated on window.__coverage__
  • after cypress spec runs, use cy.writeFile to save the report to .nyc_output
  • and generate the report with cy.exec('nyc report --reporter=html')

you should then be able the view the html coverage report in the coverage/ directory

Examples

Example to show the fix for this specific stackoverflow question

cypress with code coverage set up on a newly-ejected create-react-app

uses:

  • @babel/preset-typescript
  • @cypress/webpack-preprocessor
  • @cypress/webpack-preprocessor
  • babel-plugin-istanbul

code coverage on a vanilla typescript & webpack project

uses:

  • @babel/preset-typescript
  • @cypress/webpack-preprocessor
  • babel-loader
  • babel-plugin-istanbul

Future

  • example with ts-loader
  • example with bundlers besides webpack
  • more tests for edge cases in cypress tests

License

MIT

About

A repo to help you with code coverage + cypress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published