Skip to content
Example of Cypress.io code coverage collected from webpack dev server
Branch: master
Clone or download

README.md

code-coverage-webpack-dev-server renovate-app badge CircleCI

Example of Cypress.io code coverage collected from webpack dev server

Webpack dev server setup following blog post Webpack with Babel 7 Project Setup.

Install and start

npm ci
npm start

Open localhost:8080

Code instrumentation

Only enabled in NODE_ENV=test environment via env option in .babelrc file.

To serve the app using webpack-dev-server with instrumented app and open Cypress use:

npm run dev

Notice the window.__coverage__ object in the application iframe:

Test and coverage

To run headless end-to-end tests and have coverage use:

npm run e2e

In both cases, the coverage HTML report will be saved, open it with

open coverage/index.html

Coverage HTML report

NPM scripts

See package.json for all NPM scripts.

More information

You can’t perform that action at this time.