Skip to content

Commit 319dcc7

Browse files
cjihrigRafaelGSS
authored andcommitted
test: force spec reporter in test-runner-watch-mode.mjs
In the CI this test generates TAP output that can confuse the Python test runner. Avoid the problem by not outputting TAP at from the spawned child process. Fixes: #54535 PR-URL: #54538 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f7506ff commit 319dcc7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/parallel/test-runner-watch-mode.mjs

+11-10
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ async function testWatch({ fileToUpdate, file, action = 'update' }) {
4141
const ran1 = util.createDeferredPromise();
4242
const ran2 = util.createDeferredPromise();
4343
const child = spawn(process.execPath,
44-
['--watch', '--test', file ? fixturePaths[file] : undefined].filter(Boolean),
44+
['--watch', '--test', '--test-reporter=spec',
45+
file ? fixturePaths[file] : undefined].filter(Boolean),
4546
{ encoding: 'utf8', stdio: 'pipe', cwd: tmpdir.path });
4647
let stdout = '';
4748
let currentRun = '';
@@ -50,7 +51,7 @@ async function testWatch({ fileToUpdate, file, action = 'update' }) {
5051
child.stdout.on('data', (data) => {
5152
stdout += data.toString();
5253
currentRun += data.toString();
53-
const testRuns = stdout.match(/# duration_ms\s\d+/g);
54+
const testRuns = stdout.match(/duration_ms\s\d+/g);
5455
if (testRuns?.length >= 1) ran1.resolve();
5556
if (testRuns?.length >= 2) ran2.resolve();
5657
});
@@ -71,10 +72,10 @@ async function testWatch({ fileToUpdate, file, action = 'update' }) {
7172
assert.strictEqual(runs.length, 2);
7273

7374
for (const run of runs) {
74-
assert.match(run, /# tests 1/);
75-
assert.match(run, /# pass 1/);
76-
assert.match(run, /# fail 0/);
77-
assert.match(run, /# cancelled 0/);
75+
assert.match(run, /tests 1/);
76+
assert.match(run, /pass 1/);
77+
assert.match(run, /fail 0/);
78+
assert.match(run, /cancelled 0/);
7879
}
7980
};
8081

@@ -94,10 +95,10 @@ async function testWatch({ fileToUpdate, file, action = 'update' }) {
9495
assert.strictEqual(runs.length, 2);
9596

9697
for (const run of runs) {
97-
assert.match(run, /# tests 1/);
98-
assert.match(run, /# pass 1/);
99-
assert.match(run, /# fail 0/);
100-
assert.match(run, /# cancelled 0/);
98+
assert.match(run, /tests 1/);
99+
assert.match(run, /pass 1/);
100+
assert.match(run, /fail 0/);
101+
assert.match(run, /cancelled 0/);
101102
}
102103
};
103104

0 commit comments

Comments
 (0)