question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set coverageThreshold with CLI

See original GitHub issue

As the code, https://github.com/facebook/jest/blob/3e805bc082c8da90c33a4dff9d3e1b0804a4386d/packages/jest-cli/src/cli/args.js#L211

The argument should be a JSON string, but the below command always doesn’t work.

 jest --coverage --coverageThreshold='{\"global\":{\"branches\":90,\"functions\":90,\"lines\":90,\"statements\":90}'

It should be failed since it does not reach the target. However, it is always successful. image

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
natealcedocommented, Dec 21, 2018

Hey, I actually don’t see this in the docs. https://jestjs.io/docs/en/cli.html#options Perhaps cli docs are out of date?

1reaction
nikolay-borzovcommented, Nov 3, 2021

On Windows I had to escape \

"test:coverage": "jest --coverage --changedSince=master --coverageThreshold=\"{\\\"global\\\":{\\\"statements\\\":80,\\\"branches\\\":80}}\"",

which results

jest --coverage --changedSince=master --coverageThreshold="{\"global\":{\"statements\":80,\"branches\":80}}"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring code coverage in Jest, the right way
In this brief tutorial we see how to configure code coverage for Jest, the right way. ... In Jest we can configure coverageThreshold...
Read more >
How do i set threshold per each file using nyc Istanbul CLI ...
I'm able to set coverage threshold globally, but how can i set threshold per file basis or get the coverage percentage correctly in...
Read more >
Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >
coverage-threshold - PyPI
Tools for coverage threshold limits. ... pip install coverage-threshold ... src/cli/my_command.py"] file_line_coverage_min = 100 ...
Read more >
Configuring package.json · Jest
Add "text" or "text-summary" to see a coverage summary in the console output. coverageThreshold [object] #. Default: undefined. This will be used to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found