| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6e1beda commit 399ac68
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -551,7 +551,7 @@ function getCoverageReport(pad, summary, symbol, color, table) { | |||
| 551 | 551 | ||
| 552 | 552 | function printCoverageBodyTree(tree, depth = 0) { | |
| 553 | 553 | for (const key in tree) { | |
| 554 | - if (tree[key].file) { | ||
| 554 | + if (tree[key].file?.path) { | ||
| 555 | 555 | const file = tree[key].file; | |
| 556 | 556 | const fileName = ArrayPrototypePop(StringPrototypeSplit(file.path, sep)); | |
| 557 | 557 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,4 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + module.exports.fn = function() { | ||
| 3 | + return 1; | ||
| 4 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,7 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const { fn } = require('./file/file'); | ||
| 3 | + const test = require('node:test'); | ||
| 4 | + | ||
| 5 | + test('coverage with file/file directory structure', () => { | ||
| 6 | + fn(); | ||
| 7 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -550,3 +550,19 @@ test('correctly prints the coverage report of files contained in parent director | |||
| 550 | 550 | assert(result.stdout.toString().includes(report)); | |
| 551 | 551 | assert.strictEqual(result.status, 0); | |
| 552 | 552 | }); | |
| 553 | + | ||
| 554 | + // Regression test for https://github.com/nodejs/node/issues/61080 | ||
| 555 | + test('coverage with directory and file named "file"', skipIfNoInspector, () => { | ||
| 556 | + const fixture = fixtures.path('test-runner', 'coverage-file-name', 'test.js'); | ||
| 557 | + const args = [ | ||
| 558 | + '--experimental-test-coverage', | ||
| 559 | + '--test-reporter', | ||
| 560 | + 'tap', | ||
| 561 | + fixture, | ||
| 562 | + ]; | ||
| 563 | + const result = spawnSync(process.execPath, args); | ||
| 564 | + | ||
| 565 | + assert.strictEqual(result.stderr.toString(), ''); | ||
| 566 | + assert.strictEqual(result.status, 0); | ||
| 567 | + assert(result.stdout.toString().includes('start of coverage report')); | ||
| 568 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments