Skip to content

Commit

Permalink
Avoid use of in non-nodenext test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion committed Jun 24, 2022
1 parent 3cc59ec commit 8d97835
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/test/esm-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions tests/esm-child-process/process-forking-nested-esm/index.ts
Original file line number Diff line number Diff line change
@@ -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',
});

Expand Down
5 changes: 1 addition & 4 deletions tests/esm-child-process/process-forking/index.ts
Original file line number Diff line number Diff line change
@@ -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',
});

Expand Down

0 comments on commit 8d97835

Please sign in to comment.