Skip to content

Commit f59117e

Browse files
panvaaduh95
authored andcommitted
test: deflake watch cwd with isolation none
Windows directory watchers report last-access time updates. Reading cold fixtures in the child can therefore trigger test:watch:restarted before it exits, failing the mustNotCall assertion without printing the error. Read the fixtures before starting watch mode and remove the Windows flaky expectation. With old access times and a delayed child exit, the original fails 10/10 runs and the change passes 100/100 on Windows. Also remove the argv variant's stale flaky expectation. It passes repeated local Windows runs and the inspected CI history after #66035. Refs: #66056 Refs: #66035 Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: #66320 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent f23010d commit f59117e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎test/test-runner/test-run-watch-cwd-isolation-none.mjs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
// Test run({ watch: true, cwd, isolation: 'none' }) runs with different cwd while in watch mode and isolation none
22
import * as common from '../common/index.mjs';
33
import * as fixtures from '../common/fixtures.mjs';
4+
import { readdir, readFile } from 'node:fs/promises';
45
import { run } from 'node:test';
56
import { skipIfNoWatch } from '../common/watch.js';
67

78
skipIfNoWatch();
89

10+
// Read the fixtures before watching them. On Windows, their first read can
11+
// update access times and trigger a restart without changing their contents.
12+
const cwd = fixtures.path('test-runner-watch');
13+
await Promise.all((await readdir(cwd)).map((file) => readFile(fixtures.path('test-runner-watch', file))));
14+
915
const controller = new AbortController();
1016
const stream = run({
11-
cwd: fixtures.path('test-runner-watch'),
17+
cwd,
1218
watch: true,
1319
signal: controller.signal,
1420
isolation: 'none',

‎test/test-runner/test-runner.status‎

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

77
[true] # This section applies to all platforms
8-
9-
[$system==win32]
10-
# https://github.com/nodejs/node/issues/66056
11-
test-run-watch-cwd-isolation-none: PASS, FLAKY
12-
test-run-watch-cwd-isolation-none-argv: PASS, FLAKY

0 commit comments

Comments
 (0)