test: split test-runner-watch-mode

The test has been flaky for years and new platforms keep popping
up. As it squeezes too many independent test cases into one file,
split them into individual files to avoid masking regressions
and help only mark the real flaky ones as flaky. This might also
help with the flakiness itself by avoiding updating a shared tmpdir
being watched by differet tests and avoiding running all these
time-consuming tests in one file, which can cause a timeout
on slow machines.

PR-URL: https://github.com/nodejs/node/pull/60391
Refs: https://github.com/nodejs/node/issues/49605
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Joyee Cheung authored and Antoine du Hamel committed 2025-11-13 22:44:13 +01:00
1 parent e78e0cf6e7
commit bbca57584b
18 files changed
+117 -49

No files matched your search

-4
View File
@@ -50,10 +50,6 @@ test-runner-run-watch: PASS, FLAKY
# https://github.com/nodejs/node/issues/58353
test-http2-debug: PASS, FLAKY
[$system==linux || $system==win32]
# https://github.com/nodejs/node/issues/49605
test-runner-watch-mode: PASS,FLAKY
[$system==macos]
# https://github.com/nodejs/node/issues/42741
test-http-server-headers-timeout-keepalive: PASS,FLAKY
-44
View File
@@ -1,44 +0,0 @@
import '../common/index.mjs';
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
import { describe, it, beforeEach } from 'node:test';
skipIfNoWatch();
describe('test runner watch mode', () => {
beforeEach(refreshForTestRunnerWatch);
for (const isolation of ['none', 'process']) {
describe(`isolation: ${isolation}`, () => {
it('should run tests repeatedly', async () => {
await testRunnerWatch({ file: 'test.js', fileToUpdate: 'test.js', isolation });
});
it('should run tests with dependency repeatedly', async () => {
await testRunnerWatch({ file: 'test.js', fileToUpdate: 'dependency.js', isolation });
});
it('should run tests with ESM dependency', async () => {
await testRunnerWatch({ file: 'test.js', fileToUpdate: 'dependency.mjs', isolation });
});
it('should support running tests without a file', async () => {
await testRunnerWatch({ fileToUpdate: 'test.js', isolation });
});
it('should support a watched test file rename', async () => {
await testRunnerWatch({ fileToUpdate: 'test.js', action: 'rename', isolation });
});
it('should not throw when delete a watched test file', async () => {
await testRunnerWatch({ fileToUpdate: 'test.js', action: 'delete', isolation });
});
it('should run new tests when a new file is created in the watched directory', {
todo: isolation === 'none' ?
'This test is failing when isolation is set to none and must be fixed' :
undefined,
}, async () => {
await testRunnerWatch({ action: 'create', fileToCreate: 'new-test-file.test.js', isolation });
});
});
}
});