-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running npm react-scripts test
ignores the --coverage
option
#7407
Comments
does CI=true or --bail help? |
Yes, the exit code issue you mentioned here is definitely a bug. There is already a handful of duplicate issues, however I don't think anyone has looked into what went wrong. |
The CI param doesn't work. In dev, we have to include the
|
correct, CI=true is what I meant. |
|
We have a fix and it will be released in 3.1: #7433 |
@bugzpodder Thanks for fixing it! When is 3.1 coming out? EDIT: I just saw this: https://github.com/facebook/create-react-app/projects/8. Am I guessing its out when all those items are done. |
Thanks for the patience. 3.1 is expected to be out this week. Unfinished items from the list will be moved to 3.2. |
Can confirm this is fixed in 3.1.0 - great work! |
Describe the bug
As per #7164, running
npm react-scripts test
ignores the--coverage
option for jest - that is, jest will pass even if coverage thresholds are not reached. Note that this is almost certainly NOT an issue with jest - it is an issue withcreate-react-app
's configuration of jest.Did you try recovering your dependencies?
I've tried this with both yarn version 1.16.0 and 1.17.3 (thanks for reminding me to update yarn) - and I also removed
node_modules
andyarn.lock
and then re-installed, which didn't change anything.Which terms did you search for in User Guide?
I didn't search the user guide at all, I searched open + closed issues in this repo, and found #7164.
Environment
Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz
Binaries:
Node: 8.11.0 - ~/.nvm/versions/node/v8.11.0/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.0/bin/npm
Browsers:
Chrome: 75.0.3770.142
Firefox: Not Found
Safari: 12.1.1
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-scripts: 3.0.1 => 3.0.1
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
See $7164 for a trivial reproduction of the issue.
Expected behavior
The
--coverage
flag should fail tests when the coverage threshold is not met.Actual behavior
The
--coverage
flag does not fail tests when the coverage threshold is not met.More detailed explanation
Our repo is somewhat complex - we're using react on the front-end (tested with jest) and node on our back-end (tested with the same jest binary). Here are the two commands we run in
package.json
:Here's some relevant parts of
package.json
:And here's
jest.config.js
:For the
test-backend
command, jest will fail if the coverage thresholds are not met. However, jest still passes for thetest-frontend
command if thresholds are not met. I'm fairly confident this means the issues lies withcreate-react-app
and notjest
, as both commands use the same jest binary and have fairly minimal configuration.The text was updated successfully, but these errors were encountered: