diff --git a/test/parallel/test-process-load-env-file.js b/test/parallel/test-process-load-env-file.js index a84795c7e3f1d3..41e487b39b390c 100644 --- a/test/parallel/test-process-load-env-file.js +++ b/test/parallel/test-process-load-env-file.js @@ -58,13 +58,17 @@ describe('process.loadEnvFile()', () => { const originalCwd = process.cwd(); try { - process.chdir(join(originalCwd, 'lib')); + if (common.isMainThread) { + process.chdir(join(originalCwd, 'lib')); + } assert.throws(() => { process.loadEnvFile(); }, { code: 'ENOENT', syscall: 'open', path: '.env' }); } finally { - process.chdir(originalCwd); + if (common.isMainThread) { + process.chdir(originalCwd); + } } });