Skip to content

Commit 83d4d97

Browse files
committed
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 avoid updating a shared tmpdir being watched by differet tests.
1 parent 9c49eec commit 83d4d97

18 files changed

+117
-49
lines changed

test/common/watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function testRunnerWatch({
6060
['--watch', '--test', '--test-reporter=spec',
6161
isolation ? `--test-isolation=${isolation}` : '',
6262
file ? fixturePaths[file] : undefined].filter(Boolean),
63-
{ encoding: 'utf8', stdio: ['inherit', 'pipe', 'inherit'], cwd: tmpdir.path });
63+
{ encoding: 'utf8', stdio: 'pipe', cwd: tmpdir.path });
6464
let stdout = '';
6565
let currentRun = '';
6666
const runs = [];

test/parallel/parallel.status

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ test-runner-run-watch: PASS, FLAKY
5050
# https://github.com/nodejs/node/issues/58353
5151
test-http2-debug: PASS, FLAKY
5252

53-
[$system==linux || $system==win32]
54-
# https://github.com/nodejs/node/issues/49605
55-
test-runner-watch-mode: PASS,FLAKY
56-
5753
[$system==macos]
5854
# https://github.com/nodejs/node/issues/42741
5955
test-http-server-headers-timeout-keepalive: PASS,FLAKY

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

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/test-runner/test-runner.status

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ prefix test-runner
55
# sample-test : PASS,FLAKY
66

77
[true] # This section applies to all platforms
8+
9+
# https://github.com/nodejs/node/pull/54888#issuecomment-2351128116
10+
# TODO(pmarchini): This test is failing when isolation is set to none and must be fixed.
11+
test-watch-create-isolation-none: SKIP
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=none runs tests when a new file is created in the watched directory
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ action: 'create', fileToCreate: 'new-test-file.test.js', isolation: 'none' });
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=process runs tests when a new file is created in the watched directory
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ action: 'create', fileToCreate: 'new-test-file.test.js', isolation: 'process' });
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=none does not throw when deleting a watched test file
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ fileToUpdate: 'test.js', action: 'delete', isolation: 'none' });
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=process does not throw when deleting a watched test file
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ fileToUpdate: 'test.js', action: 'delete', isolation: 'process' });
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=none runs tests with dependency repeatedly
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ file: 'test.js', fileToUpdate: 'dependency.js', isolation: 'none' });
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Test --test --watch --test-isolation=process runs tests with dependency repeatedly
2+
import '../common/index.mjs';
3+
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
4+
5+
skipIfNoWatch();
6+
refreshForTestRunnerWatch();
7+
8+
await testRunnerWatch({ file: 'test.js', fileToUpdate: 'dependency.js', isolation: 'process' });

0 commit comments

Comments
 (0)