test: deflake test-run-watch-cwd-isolation-none-* · nodejs/node@dda22c0 · GitHub
Skip to content

Commit dda22c0

Browse files
committed
test: deflake test-run-watch-cwd-isolation-none-*
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #66035 Refs: #66056 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent eb4fabe commit dda22c0

3 files changed

Lines changed: 35 additions & 28 deletions

File tree

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

Lines changed: 18 additions & 12 deletions
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
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';
3+
import * as fixtures from '../common/fixtures.mjs';
34
import { run } from 'node:test';
4-
import tmpdir from '../common/tmpdir.js';
5-
import { refreshForTestRunnerWatch, skipIfNoWatch } from '../common/watch.js';
5+
import { skipIfNoWatch } from '../common/watch.js';
66

77
skipIfNoWatch();
8-
refreshForTestRunnerWatch();
98

109
const controller = new AbortController();
1110
const stream = run({
12-
cwd: tmpdir.path,
11+
cwd: fixtures.path('test-runner-watch'),
1312
watch: true,
1413
signal: controller.signal,
1514
isolation: 'none',
16-
}).on('data', function({ type }) {
17-
if (type === 'test:watch:drained') {
18-
stream.removeAllListeners('test:fail');
19-
stream.removeAllListeners('test:pass');
20-
controller.abort();
21-
}
15+
}).on('data', ({ type }) => {
16+
if (type !== 'test:watch:drained') return;
17+
18+
stream.removeAllListeners('test:fail');
19+
stream.removeAllListeners('test:pass');
20+
controller.abort();
2221
});
2322

24-
stream.on('test:fail', common.mustNotCall());
25-
stream.on('test:pass', common.mustCall(1));
26-
// eslint-disable-next-line no-unused-vars
27-
for await (const _ of stream);
23+
stream.on('test:watch:restarted', common.mustNotCall('test:watch:restarted'));
24+
stream.on('test:fail', common.mustNotCall('test:fail'));
25+
stream.on('test:pass', common.mustCall());
26+
27+
// eslint-disable-next-line no-empty-pattern
28+
for await (const {} of stream);

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

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)