fix: allow usage of ts-node in sub-processes (#20762)

This commit is contained in:
Barthélémy Ledoux
2022-03-23 22:17:32 -04:00
committed by GitHub
parent 61f7cfc592
commit f898ea7963

View File

@@ -1001,15 +1001,17 @@ export class ProjectLifecycleManager {
private forkConfigProcess () {
const configProcessArgs = ['--projectRoot', this.projectRoot, '--file', this.configFilePath]
// allow the use of ts-node in subprocesses tests by removing the env constant from it
// without this line, packages/ts/register.js never registers the ts-node module for config and
// run_plugins can't use the config module.
const { CYPRESS_INTERNAL_E2E_TESTING_SELF, ...env } = process.env
env.NODE_OPTIONS = process.env.ORIGINAL_NODE_OPTIONS || ''
const childOptions: ForkOptions = {
stdio: 'pipe',
cwd: path.dirname(this.configFilePath),
env: {
...process.env,
NODE_OPTIONS: process.env.ORIGINAL_NODE_OPTIONS || '',
// DEBUG: '*',
},
env,
execPath: this.ctx.nodePath ?? undefined,
}