Commit 399ac68
test_runner: fix coverage report when a directory is named file
The coverage tree traversal checked `tree[key].file` to detect file
entries. When a directory named "file" contained a file also named
"file", this check incorrectly matched the child entry instead of
file metadata, causing a TypeError when accessing `.path`.
Check for `.file?.path` instead to correctly identify file metadata.
Fixes: #61080
PR-URL: #61169
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>1 parent 6e1beda commit 399ac68Copy full SHA for 399ac68
4 files changed
+28-1Lines changed: 28 additions & 1 deletion
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib/internal/test_runner
- test
- fixtures/test-runner/coverage-file-name
- file
- parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
lib/internal/test_runner/utils.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
551 | 551 | |
552 | 552 | |
553 | 553 | |
554 | | - |
| 554 | + |
555 | 555 | |
556 | 556 | |
557 | 557 | |
|
Collapse file
test/fixtures/test-runner/coverage-file-name/file/file
Copy file name to clipboard+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
Collapse file
test/fixtures/test-runner/coverage-file-name/test.js
Copy file name to clipboard+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
Collapse file
test/parallel/test-runner-coverage.js
Copy file name to clipboardExpand all lines: test/parallel/test-runner-coverage.js+16Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
550 | 550 | |
551 | 551 | |
552 | 552 | |
| 553 | + |
| 554 | + |
| 555 | + |
| 556 | + |
| 557 | + |
| 558 | + |
| 559 | + |
| 560 | + |
| 561 | + |
| 562 | + |
| 563 | + |
| 564 | + |
| 565 | + |
| 566 | + |
| 567 | + |
| 568 | + |
0 commit comments