Skip to content

"npm test" with "--coverage" argument doesn't make the script fail even if the threshold is not met #7164

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

Closed
trish123 opened this issue Jun 4, 2019 · 4 comments

Comments

@trish123
Copy link

trish123 commented Jun 4, 2019

  1. Create an app with CRA

  2. Add the coverage threshold in the package.json file
    "coverageThreshold": {
    "global": {
    "branches": 90,
    "functions": 90,
    "lines": 90,
    "statements": 90
    }
    }

  3. run the command - npm test -- --watchAll=false --coverage

  4. We can see "index.tsx" is not covered and the "threshold not met" messages in the console. But the script is not failing.

@bugzpodder
Copy link

Does CI=true work for you?

@trish123
Copy link
Author

trish123 commented Jun 5, 2019

Does CI=true work for you?

Yes. It works in CI server. If i set the env (CI) variable, it works in local system as well. I am running this as part of precommit hook. Is it recommended to set CI variable? Or is it a workaround?

@bugzpodder
Copy link

I am not sure why there is a difference. I think this is a jest bug.

@trish123
Copy link
Author

trish123 commented Jun 5, 2019

Thanks

@lock lock bot locked and limited conversation to collaborators Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants