Content-Length: 394848 | pFad | https://redirect.github.com/nodejs/node/commit/edb7dd1ec7

91 test_runner: match minimum file column to 'all files' · nodejs/node@edb7dd1 · GitHub
Skip to content

Commit edb7dd1

Browse files
islandryuaduh95
authored andcommitted
test_runner: match minimum file column to 'all files'
PR-URL: #57848 Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
1 parent 938f153 commit edb7dd1

File tree

4 files changed

+42
-3
lines changed

4 files changed

+42
-3
lines changed

lib/internal/test_runner/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ function getCoverageReport(pad, summary, symbol, color, table) {
465465
if (color) {
466466
filePadLength += 2;
467467
}
468-
filePadLength = MathMax(filePadLength, 'file'.length);
468+
filePadLength = MathMax(filePadLength, 'all files'.length);
469469
if (filePadLength > (process.stdout.columns / 2)) {
470470
filePadLength = MathFloor(process.stdout.columns / 2);
471471
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Flags: --experimental-test-coverage --no-warnings
2+
// here we can't import common module as the coverage will be different based on the system
3+
// Unused imports are here in order to populate the coverage report
4+
// eslint-disable-next-line no-unused-vars
5+
import * as a from '../coverage-snap/a.js';
6+
7+
import { test } from 'node:test';
8+
9+
test(`Coverage Print Short Filename`);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
TAP version 13
2+
# Subtest: Coverage Print Short Filename
3+
ok 1 - Coverage Print Short Filename
4+
---
5+
duration_ms: *
6+
type: 'test'
7+
...
8+
1..1
9+
# tests 1
10+
# suites 0
11+
# pass 1
12+
# fail 0
13+
# cancelled 0
14+
# skipped 0
15+
# todo 0
16+
# duration_ms *
17+
# start of coverage report
18+
# ---------------------------------------------------------------------------------------
19+
# file | line % | branch % | funcs % | uncovered lines
20+
# ---------------------------------------------------------------------------------------
21+
# a.js | 55.77 | 100.00 | 0.00 | 5-7 9-11 13-15 17-19 29-30 40-42 45-47 50-52
22+
# ---------------------------------------------------------------------------------------
23+
# all files | 55.77 | 100.00 | 0.00 |
24+
# ---------------------------------------------------------------------------------------
25+
# end of coverage report

test/parallel/test-runner-output.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,17 @@ const tests = [
297297
name: 'test-runner/output/coverage-width-infinity-uncovered-lines.mjs',
298298
flags: ['--test-reporter=tap'],
299299
} : false,
300+
process.features.inspector ? {
301+
name: 'test-runner/output/coverage-short-filename.mjs',
302+
flags: ['--test-reporter=tap', '--test-coverage-exclude=../output/**'],
303+
cwd: fixtures.path('test-runner/coverage-snap'),
304+
} : false,
300305
]
301306
.filter(Boolean)
302-
.map(({ flags, name, tty, transform }) => ({
307+
.map(({ flags, name, tty, transform, cwd }) => ({
303308
name,
304309
fn: common.mustCall(async () => {
305-
await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { tty, flags });
310+
await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { tty, flags, cwd });
306311
}),
307312
}));
308313

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://redirect.github.com/nodejs/node/commit/edb7dd1ec7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy