Cypress plugin to collect coverage data directly from a Google Chrome instance.
-
This plugin only works with Google Chrome because it relies on using Chrome Debugging Protocol to collect coverage data.
-
The collected coverage data is a raw data in Chrome Debugging Protocol’s native format. You need to use tools such as v8-to-istanbul to convert it to a format you desire.
In your Cypress plugins/index.js
file:
require('cypress-cdp-coverage/plugin')(on, config)
In your Cypress support/index.js
file:
import 'cypress-cdp-coverage/support'
When running Cypress, set the environment variable CYPRESS_CDP_COVERAGE
to a directory. When tests are run, the coverage data will be written to that directory.
This Cypress plugin is inspired by v8-cypress-coverage-plugin. The main difference is that this plugin does not perform any post-processing on the coverage data and it is up to the user to do so.