问题
I used following command to run my tests and get a coverage report:
jest --coverage
now I want to check whether percentage of coverage is more than 90% or not in my script file. what should I do ?
回答1:
You can use the coverageThreshold option in your Jest configuration:
https://jestjs.io/docs/en/configuration#coveragethreshold-object
{
...
"jest": {
"coverageThreshold": {
"global": {
"branches": 50,
"functions": 50,
"lines": 50,
"statements": 50
}
}
}
}
来源:https://stackoverflow.com/questions/40794031/jest-is-there-a-way-to-check-percentage-of-test-coverage