Description
Feature Request: istanbuljs / nyc test coverage report validation along with individual files with different configuration 🙏🏼
This is not an issue, needs some confirmation about nyc configuration.
I am writing unit-test cases using mocha, istanbul & nyc.
If we try to check the overall coverage report should cover 80% then .nycrc.json
configuration as follows:
{
"statements": 80,
"branches": 80,
"functions": 80,
"lines": 80
}
And if any coverage is not covered 80% then it is throwing an error in the terminal.
Now, my question: is there any way to check individual files should cover some coverage reports? ()
For example:
-
I am trying to configure the
.nycrc.json
in such a way that, individual files should be covered 65% at least and the overall report should be covered 80%. -
As the consolated report doesn't pass the 80% then it automatically throws an error in the terminal. In a similar way if the individual file doesn't cover the 65% coverage then it should throw an error like "Single file don't cover in the file: file_name".
-
So, in
.nycrc.json
there I want to add two configurations (consolidated coverage & individual coverage) like:
// consolated coverage validation: Check Over all report: already implemented
{
"statements": 80,
"branches": 80,
"functions": 80,
"lines": 80
}
// individual files coverage validation with some other config
{
"statements": 65,
"branches": 65,
"functions": 65,
"lines": 65
}
This is my .nycrc.json
file:
{
"cache": false,
"check-coverage": true,
"extension": [".js"],
"include": ["src/**/*.js"],
"exclude": ["src/**/*.test.js"],
"reporter": [
"lcov",
"text",
"text-summary",
"cobertura"
],
"report-dir": "unittest_report",
"statements": 80,
"branches": 80,
"functions": 80,
"lines": 80,
"watermarks": {
"statements": [70, 90],
"branches": [70, 90],
"functions": [70, 90],
"lines": [70, 90]
}
}
I am trying to add this validation in nyc config like watermarks for individual files and if the individual files don't cover 65% then it should throw an error or show a warning end of the report.