Last updated
Last updated
TL;DR
See a working
Install cypress-cloud
version 1.9.5+
Install and configure Cypress Code coverage plugin as described
Run cypress-cloud
with --experimental-coverage-recording
CLI flag enabled
Enabling code coverage for Cypress involves the following steps:
Instrumenting the code and generating the coverage report (done by cypress
runner together with Istanbul or any other coverage tool)
Uploading the report to Currents for processing (done by cypress-cloud
package)
Instrumenting the code and generating reports is well described in the detailed .
In short:
Install and configure the official plugin together with the @cypress/code-coverage/support
support file (the plugin is developed and maintained by the Cypress.io team)
Add - for example, by using @cypress/code-coverage/use-babelrc
for on-the-fly instrumentation
If you haven’t yet, ; make sure to add cypress-cloud/plugin
after @cypress/code-coverage
Optional: provide custom location for generated reports:
cypress-cloud
expects to find the coverage reports at their default location at <projectRoot>/.nyc_output/out.json
You can provide a custom location by setting env.coverageFile
in cypress.config.{jt}s
Example cypress.config.ts
file
Example Cypress support.ts
file
cypress-cloud
with coverage enabledRunning cypress-cloud
with --experimental-coverage-recording
flag will activate the collection of the coverage reports and send them to Currents for processing.
The script will discover the reports at the configured location ./.nyc_output/out.json
by default, or an explicit location defined in env.coverageFile
of cypress.config.{jt}s
Example:
Learn how to setup Cypress to start reporting code coverage results