-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
test_runner: exclude test files from code coverage by default #55633
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1359,6 +1359,8 @@ changes: | |||||
This property is only applicable when `coverage` was set to `true`. | ||||||
If both `coverageExcludeGlobs` and `coverageIncludeGlobs` are provided, | ||||||
files must meet **both** criteria to be included in the coverage report. | ||||||
By default, the files being tested are excluded from code coverage. They can be explicitly | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
included via this parameter. | ||||||
**Default:** `undefined`. | ||||||
* `lineCoverage` {number} Require a minimum percent of covered lines. If code | ||||||
coverage does not reach the threshold specified, the process will exit with code `1`. | ||||||
|
Llorx marked this conversation as resolved.
Show resolved
Hide resolved
Llorx marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have mixed feelings about all these WDYT? cc @nodejs/test_runner @redyetidev There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also have mixed feelings about it, as ** would also include anything in node_modules. I'm honestly okay with keeping the test files in the coverage report, and having the user exclude them manually with the exclude flag. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The thing with the filters is that I can't think of any reason a user would want the test files in the coverage report, so we are going to force all the developers to handle a dirty output that they don't actually want, or force them to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Node.js test files, the I've self-addressed my concerns: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh I see, that's true, and that's not comfortable neither... I think that the more we are talking, the more this is heading to have an exclusive There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe, but that could be done in a followup if users show that they need it. For now, maybe this is okay? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, for me it is okay obviosuly because it fits my needs haha. We can see how people reacts to this. This is my first PR so I don't know how this works. This first goes to the non LTS and when people complain/debate/whatever it goes to the LTS if okay, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, that's how it works. I'm happy to see where this goes. |
||
`${coverage.flag}=25`, | ||
'--test-reporter', 'tap', | ||
fixture, | ||
|
@@ -77,6 +79,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
`${coverage.flag}=25`, | ||
'--test-reporter', reporter, | ||
fixture, | ||
|
@@ -92,6 +96,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
`${coverage.flag}=99`, | ||
'--test-reporter', 'tap', | ||
fixture, | ||
|
@@ -108,6 +114,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
`${coverage.flag}=99`, | ||
'--test-reporter', reporter, | ||
fixture, | ||
|
@@ -123,6 +131,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
`${coverage.flag}=101`, | ||
fixture, | ||
]); | ||
|
@@ -136,6 +146,8 @@ for (const coverage of coverages) { | |
const result = spawnSync(process.execPath, [ | ||
'--test', | ||
'--experimental-test-coverage', | ||
'--no-warnings', | ||
'--test-coverage-include=**', | ||
`${coverage.flag}=-1`, | ||
fixture, | ||
]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.