Skip to content
Cypress tests for a React application created using CRA v3
JavaScript HTML CSS
Branch: master
Clone or download
Pull request Compare This branch is 1 commit ahead of coryhouse:master.
bahmutov Measure code coverage using Cypress tests (#1)
* add Cypress code coverage

* add Cypress test

* remove .only

* use public @cypress/instrument-cra version

* add unit tests

* rename spec file

* add more notes to README

* exact versions

* add app demo gif

* add other pages specs

* more unit tests
Latest commit 2e23783 Aug 12, 2019

Testing Demo App

This project was bootstrapped with Create React App.

Fuel savings

Quick Start

npm install
npm start

The above commands will install dependencies and start the app. To run tests, run npm test on a separate command line. There are no tests written in the master branch.

Tip: to start the application and the mock API and open Cypress, you can use start-server-and-test utility.

npm run dev

Testing libraries

This instance of create-react-app has been enhanced with the following testing libraries:

Library Description
Jest Automated testing
Enzyme Unit test React components in isolation via shallow or with children via mount
enzyme-adapter-react-16 Configures enzyme to work with React 16
react-test-renderer Render React components to JSON for snapshot testing
redux-mock-store Mock store for testing your redux async action creators and middleware
Cypress In browser integration testing via Mocha and Chai

Complete code coverage with Cypress

When you run the application with npm start it instruments the source code using @cypress/instrument-cra module. The code coverage is collected using @cypress/code-coverage plugin and saved in coverage folder.

Coverage report

For more details about code coverage, see

You can’t perform that action at this time.