Skip to content

Guide: Code Coverage with "react scripts test"

MichaelDimmitt edited this page Jul 6, 2018 · 3 revisions

Setting code coverage up on a create react app:

Actual Coding Changes/Decisions

Different options for implementing code coverage for Create React App or Jest

Overview

  1. Basically jest and create-react-app require --coverage flag to provide code coverage.
  2. codecov is a package that hosts all coverage reports on a website for transparency.

Trouble Shooting

  1. Source Document, code coverage from create react app docs, link1
  2. Issue with npm test: use yarn test instead of npm test if you did yarn install, link2
  3. Note: --coverage causes an npm fail if a test is failing in the test suite.