diff --git a/src/test/esm-loader.spec.ts b/src/test/esm-loader.spec.ts index 2becddb72..f12e04821 100644 --- a/src/test/esm-loader.spec.ts +++ b/src/test/esm-loader.spec.ts @@ -362,7 +362,7 @@ test.suite('esm', (test) => { test.suite('esm child process and forking', (test) => { test('should be able to fork vanilla NodeJS script', async () => { const { err, stdout, stderr } = await exec( - `${BIN_PATH} --esm ./esm-child-process/process-forking/index.ts` + `${BIN_PATH} --esm --cwd ./esm-child-process/process-forking/ index.ts` ); expect(err).toBe(null); @@ -372,7 +372,7 @@ test.suite('esm', (test) => { test('should be able to fork into a nested TypeScript ESM script', async () => { const { err, stdout, stderr } = await exec( - `${BIN_PATH} --esm ./esm-child-process/process-forking-nested-esm/index.ts` + `${BIN_PATH} --esm --cwd ./esm-child-process/process-forking-nested-esm/ index.ts` ); expect(err).toBe(null); diff --git a/tests/esm-child-process/process-forking-nested-esm/index.ts b/tests/esm-child-process/process-forking-nested-esm/index.ts index d2ebe098a..ff0f2e61b 100644 --- a/tests/esm-child-process/process-forking-nested-esm/index.ts +++ b/tests/esm-child-process/process-forking-nested-esm/index.ts @@ -1,13 +1,10 @@ import { fork } from 'child_process'; -import { dirname, join } from 'path'; -import { fileURLToPath } from 'url'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; -const projectDir = dirname(fileURLToPath(import.meta.url)); -const workerProcess = fork(join(projectDir, 'worker.ts'), [], { +const workerProcess = fork('./worker.ts', [], { stdio: 'pipe', }); diff --git a/tests/esm-child-process/process-forking/index.ts b/tests/esm-child-process/process-forking/index.ts index 52052eb72..2e3e05ec8 100644 --- a/tests/esm-child-process/process-forking/index.ts +++ b/tests/esm-child-process/process-forking/index.ts @@ -1,13 +1,10 @@ import { fork } from 'child_process'; -import { dirname, join } from 'path'; -import { fileURLToPath } from 'url'; // Initially set the exit code to non-zero. We only set it to `0` when the // worker process finishes properly with the expected stdout message. process.exitCode = 1; -const projectDir = dirname(fileURLToPath(import.meta.url)); -const workerProcess = fork(join(projectDir, 'worker.js'), [], { +const workerProcess = fork('./worker.js', [], { stdio: 'pipe', });