This is a boiled down example of a bug with Jest's code coverage reporting, when used in combination with the default caching and a monorepo (Lerna).
- Clone the repository
- Run
npm install && npm run bootstrap
- Run
npm run test:nocache
, and note in stdout thatproject1/index.js
andproject2/index.js
both have 100% coverage. This is the result of running the tests with the--no-cache
flag - Run
npm run test:cache
, and note in stdout we only see code coverage for 1 project. This is the result of running the tests with no flags - Run
npm run test:ohno
, and note in stdout we only see code coverage for 1 project. This is the result of running the tests with--no-cache
and-i