Uh oh!
There was an error while loading. Please reload this page.
test_runner: support glob matching coverage files - #53553
Conversation
nodejs-github-bot
commented
Jun 22, 2024
Review requested:
|
Blocked by #52881 - This PR relies on the (Test failures will disappear once the blocking PR lands) If a PR relies on a |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
MoLow
commented
Jun 23, 2024
please take a look at the test failures |
avivkeller
commented
Jun 23, 2024
Thanks! I'll made those changes! I've also unblocked the PR because the blocking PR has landed |
Uh oh!
There was an error while loading. Please reload this page.
avivkeller
commented
Jun 24, 2024
I'm not planning on that, this is specific to coverage, not all of testing. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
It seems pretty inefficient to check the same path as both an absolute path and a relative path. Same comment below for included globs.
There was a problem hiding this comment.
What would you recommend doing instead?
I assume users would want relative checks, but if the path is somewhere completely different, they may also want absolute?
There was a problem hiding this comment.
So one issue is that you seem to be computing absolutePath and relativePath for each iteration of the loop, even though I believe they only need to be computed once per function call.
The other thing is, since you already have absolute paths, shouldn't it be enough to glob against those? I guess I don't see anything in the tests added by this PR that would require converting url to both an absolute and relative path. This would have a nice side effect of not needing to pass workingDirectory around as well. Do you have an example where that wouldn't be the case?
There was a problem hiding this comment.
I can fix the position of the generation, but here is my reasoning for both relative and absolute testing:
var { minimatch } = require("minimatch")
var path = require("path");
const cwd = "/home/user"
const absTestFile = "/home/user/path/to/file.js"
const relTestFile = path.relative(cwd, absTestFile);
console.log("relTestFile: " + relTestFile + " | Minimatch: " + minimatch(relTestFile, "path/to/*.js")) // true
console.log("absTestFile: " + absTestFile + " | Minimatch: " + minimatch(absTestFile, "path/to/*.js")) // false
Users probably want to match the relative test file when excluding coverage files.
I need to review the new test failures, I'll address them when I get a chance |
avivkeller
commented
Jun 26, 2024
Hey, if someone could approve + CI, that would help this move to |
The
notable-change Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section. |
nodejs-github-bot
commented
Jul 14, 2024
Landed in 4174b73 |
aduh95
commented
Jul 16, 2024
This was merged with the wrong subsystem (it should be |
PR-URL: #53553 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Notable changes: http: * (SEMVER-MINOR) expose websockets (Natalia Venditto) #53721 lib: * (SEMVER-MINOR) add `node:sqlite` module (Colin Ihrig) #53752 module: * add `__esModule` to `require()`'d ESM (Joyee Cheung) #52166 path: * (SEMVER-MINOR) add `matchesGlob` method (Aviv Keller) #52881 process: * (SEMVER-MINOR) port on-exit-leak-free to core (Vinicius Lourenço) #53239 stream: * (SEMVER-MINOR) pipeline wait for close before calling the callback (jakecastelli) #53462 test_runner: * support glob matching coverage files (Aviv Keller) #53553 worker: * (SEMVER-MINOR) add `postMessageToThread` (Paolo Insogna) #53682 PR-URL: #53826
Notable changes: http: * (SEMVER-MINOR) expose websockets (Natalia Venditto) #53721 lib: * (SEMVER-MINOR) add `node:sqlite` module (Colin Ihrig) #53752 module: * add `__esModule` to `require()`'d ESM (Joyee Cheung) #52166 path: * (SEMVER-MINOR) add `matchesGlob` method (Aviv Keller) #52881 process: * (SEMVER-MINOR) port on-exit-leak-free to core (Vinicius Lourenço) #53239 stream: * (SEMVER-MINOR) pipeline wait for close before calling the callback (jakecastelli) #53462 test_runner: * support glob matching coverage files (Aviv Keller) #53553 worker: * (SEMVER-MINOR) add `postMessageToThread` (Paolo Insogna) #53682 PR-URL: #53826
Notable changes: http: * (SEMVER-MINOR) expose websockets (Natalia Venditto) #53721 lib: * (SEMVER-MINOR) add `node:sqlite` module (Colin Ihrig) #53752 module: * add `__esModule` to `require()`'d ESM (Joyee Cheung) #52166 path: * (SEMVER-MINOR) add `matchesGlob` method (Aviv Keller) #52881 process: * (SEMVER-MINOR) port on-exit-leak-free to core (Vinicius Lourenço) #53239 stream: * (SEMVER-MINOR) pipeline wait for close before calling the callback (jakecastelli) #53462 test_runner: * support glob matching coverage files (Aviv Keller) #53553 worker: * (SEMVER-MINOR) add `postMessageToThread` (Paolo Insogna) #53682 PR-URL: #53826
Notable changes: http: * (SEMVER-MINOR) expose websockets (Natalia Venditto) #53721 lib: * (SEMVER-MINOR) add `node:sqlite` module (Colin Ihrig) #53752 module: * add `__esModule` to `require()`'d ESM (Joyee Cheung) #52166 path: * (SEMVER-MINOR) add `matchesGlob` method (Aviv Keller) #52881 process: * (SEMVER-MINOR) port on-exit-leak-free to core (Vinicius Lourenço) #53239 stream: * (SEMVER-MINOR) pipeline wait for close before calling the callback (jakecastelli) #53462 test_runner: * support glob matching coverage files (Aviv Keller) #53553 worker: * (SEMVER-MINOR) add `postMessageToThread` (Paolo Insogna) #53682 PR-URL: #53826
PR-URL: nodejs#53553 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Notable changes: http: * (SEMVER-MINOR) expose websockets (Natalia Venditto) nodejs#53721 lib: * (SEMVER-MINOR) add `node:sqlite` module (Colin Ihrig) nodejs#53752 module: * add `__esModule` to `require()`'d ESM (Joyee Cheung) nodejs#52166 path: * (SEMVER-MINOR) add `matchesGlob` method (Aviv Keller) nodejs#52881 process: * (SEMVER-MINOR) port on-exit-leak-free to core (Vinicius Lourenço) nodejs#53239 stream: * (SEMVER-MINOR) pipeline wait for close before calling the callback (jakecastelli) nodejs#53462 test_runner: * support glob matching coverage files (Aviv Keller) nodejs#53553 worker: * (SEMVER-MINOR) add `postMessageToThread` (Paolo Insogna) nodejs#53682 PR-URL: nodejs#53826
targos
commented
Jul 28, 2024
It looks like the commit message was edited when it landed on v22.x: 3a0fcbb I'm marking this as backported so it doesn't show up in |
JakobJingleheimer
commented
Nov 25, 2024
Why should this not land on 20.x? |
Fixes#53508
Fixes#51222
This Pull Request introduces two new command-line interface flags to Node.js:
--test-coverage-include: Allows users to specify glob patterns to include specific files in the coverage report.--test-coverage-exclude: Allows users to specify glob patterns to exclude specific files from the coverage report.Notable change text, if any: