diff --git a/test/parallel/test-runner-run-watch.mjs b/test/parallel/test-runner-run-watch.mjs index 8ccc4646de2a26..5069011c0271d9 100644 --- a/test/parallel/test-runner-run-watch.mjs +++ b/test/parallel/test-runner-run-watch.mjs @@ -1,6 +1,6 @@ // Flags: --expose-internals import * as common from '../common/index.mjs'; -import { describe, it, beforeEach } from 'node:test'; +import { describe, it, beforeEach, run } from 'node:test'; import assert from 'node:assert'; import { spawn } from 'node:child_process'; import { once } from 'node:events'; @@ -269,4 +269,60 @@ describe('test runner watch mode', () => { } ); }); + + it('should run with different cwd while in watch mode', async () => { + const controller = new AbortController(); + const stream = run({ + cwd: tmpdir.path, + watch: true, + signal: controller.signal, + }).on('data', function({ type }) { + if (type === 'test:watch:drained') { + controller.abort(); + } + }); + + stream.on('test:fail', common.mustNotCall()); + stream.on('test:pass', common.mustCall(1)); + // eslint-disable-next-line no-unused-vars + for await (const _ of stream); + }); + + it('should run with different cwd while in watch mode and isolation "none"', async () => { + const controller = new AbortController(); + const stream = run({ + cwd: tmpdir.path, + watch: true, + signal: controller.signal, + isolation: 'none', + }).on('data', function({ type }) { + if (type === 'test:watch:drained') { + controller.abort(); + } + }); + + stream.on('test:fail', common.mustNotCall()); + stream.on('test:pass', common.mustCall(1)); + // eslint-disable-next-line no-unused-vars + for await (const _ of stream); + }); + + it('should run with different cwd while in watch mode and isolation "process"', async () => { + const controller = new AbortController(); + const stream = run({ + cwd: tmpdir.path, + watch: true, + signal: controller.signal, + isolation: 'process', + }).on('data', function({ type }) { + if (type === 'test:watch:drained') { + controller.abort(); + } + }); + + stream.on('test:fail', common.mustNotCall()); + stream.on('test:pass', common.mustCall(1)); + // eslint-disable-next-line no-unused-vars + for await (const _ of stream); + }); }); diff --git a/test/parallel/test-runner-run.mjs b/test/parallel/test-runner-run.mjs index 703f11375d7b45..05e106536c4768 100644 --- a/test/parallel/test-runner-run.mjs +++ b/test/parallel/test-runner-run.mjs @@ -588,56 +588,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { assert.strictEqual(diagnostics.includes(entry), true); } }); - - it('should run with different cwd while in watch mode', async () => { - const controller = new AbortController(); - const stream = run({ - cwd: fixtures.path('test-runner', 'cwd'), - watch: true, - signal: controller.signal, - }).on('data', function({ type }) { - if (type === 'test:watch:drained') { - controller.abort(); - } - }); - - stream.on('test:fail', common.mustNotCall()); - stream.on('test:pass', common.mustCall(1)); - }); - - it('should run with different cwd while in watch mode and isolation "none"', async () => { - const controller = new AbortController(); - const stream = run({ - cwd: fixtures.path('test-runner', 'cwd'), - watch: true, - signal: controller.signal, - isolation: 'none', - }).on('data', function({ type }) { - if (type === 'test:watch:drained') { - controller.abort(); - } - }); - - stream.on('test:fail', common.mustNotCall()); - stream.on('test:pass', common.mustCall(1)); - }); - - it('should run with different cwd while in watch mode and isolation "process"', async () => { - const controller = new AbortController(); - const stream = run({ - cwd: fixtures.path('test-runner', 'cwd'), - watch: true, - signal: controller.signal, - isolation: 'process', - }).on('data', function({ type }) { - if (type === 'test:watch:drained') { - controller.abort(); - } - }); - - stream.on('test:fail', common.mustNotCall()); - stream.on('test:pass', common.mustCall(1)); - }); }); describe('forceExit', () => {