Missing code coverage data with CRA 2.0.0-next
Created by: sbegaudeau
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Yes
Environment
Environment:
OS: Windows 10
Node: 10.4.1
Yarn: 1.7.0
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react-scripts: ^2.0.0-next.3e165448 => 2.0.0-next.b2fd8db8
Steps to Reproduce
We have migrated to a monorepo using CRA next, everything works fine except that the code coverage of the test is only working for the main application project. It does not work anymore for the other project where our components are.
- Clone this commit from our project, install the dependencies with
yarn install
and run the test with coverage usingyarn coverage
. Everything works fine, the code coverage is working as seen in the Travis build. - Now checkout this commit which configures everything for a monorepo architecture with two packages (app and core). Install everything and run the tests once again. As you could see it in the Travis build, the same tests are executed but the coverage report does not include anything anymore.
Expected Behavior
The code coverage report should include all the code covered by the executed tests.
Actual Behavior
Before
After
Reproducible Demo
Clone this commit.
- yarn install
- yarn coverage
The issue may be coming from the Jest config of CRA 2.0.0 next which seems to only look in the source folder here.
collectCoverageFrom: ['src/**/*.{js,jsx,mjs}']