Skip to content

Commit ce91536

Browse files
committed
test: fix watch cwd argv test flake
Keep the marker file outside the watched cwd so writing it does not trigger an extra watch mode rerun on Linux. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
1 parent 1434a07 commit ce91536

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// parent process argv when spawning the watch child.
33
import * as common from '../common/index.mjs';
44
import assert from 'node:assert';
5-
import { readFileSync, writeFileSync } from 'node:fs';
5+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
66
import { join } from 'node:path';
77
import { run } from 'node:test';
88
import tmpdir from '../common/tmpdir.js';
@@ -11,8 +11,10 @@ import { skipIfNoWatch } from '../common/watch.js';
1111
skipIfNoWatch();
1212
tmpdir.refresh();
1313

14+
const watchedDir = join(tmpdir.path, 'watched');
1415
const marker = join(tmpdir.path, 'marker');
15-
writeFileSync(join(tmpdir.path, 'test.js'), `
16+
mkdirSync(watchedDir);
17+
writeFileSync(join(watchedDir, 'test.js'), `
1618
const test = require('node:test');
1719
const { writeFileSync } = require('node:fs');
1820
@@ -23,7 +25,7 @@ test('test ran from cwd', () => {
2325

2426
const controller = new AbortController();
2527
const stream = run({
26-
cwd: tmpdir.path,
28+
cwd: watchedDir,
2729
watch: true,
2830
signal: controller.signal,
2931
isolation: 'none',

0 commit comments

Comments
 (0)