Skip to content

Commit 816cb63

Browse files
jbedardangular-robot[bot]
authored andcommitted
test: use execPath to launch child node processes
Using execPath ensures the child processes are the same node binary without depending on PATH.
1 parent 14a95d8 commit 816cb63

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

tests/legacy-cli/e2e/utils/process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,15 @@ export function globalNpm(args: string[], env?: NodeJS.ProcessEnv) {
345345
);
346346
}
347347

348-
return _exec({ silent: true, env }, 'node', [require.resolve('npm'), ...args]);
348+
return _exec({ silent: true, env }, process.execPath, [require.resolve('npm'), ...args]);
349349
}
350350

351351
export function npm(...args: string[]) {
352352
return _exec({}, 'npm', args);
353353
}
354354

355355
export function node(...args: string[]) {
356-
return _exec({}, 'node', args);
356+
return _exec({}, process.execPath, args);
357357
}
358358

359359
export function git(...args: string[]) {

tests/legacy-cli/e2e/utils/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function prepareProjectForE2e(name: string) {
6767
// Often fails the first time so attempt twice if necessary.
6868
const runWebdriverUpdate = () =>
6969
exec(
70-
'node',
70+
process.execPath,
7171
'node_modules/protractor/bin/webdriver-manager',
7272
'update',
7373
'--standalone',

tests/legacy-cli/e2e/utils/registry.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ export async function createNpmRegistry(
1919
configContent = configContent.replace(/\$\{HTTPS_PORT\}/g, String(httpsPort));
2020
await writeFile(join(registryPath, 'verdaccio.yaml'), configContent);
2121

22-
return spawn('node', [require.resolve('verdaccio/bin/verdaccio'), '-c', './verdaccio.yaml'], {
23-
cwd: registryPath,
24-
stdio: 'inherit',
25-
});
22+
return spawn(
23+
process.execPath,
24+
[require.resolve('verdaccio/bin/verdaccio'), '-c', './verdaccio.yaml'],
25+
{
26+
cwd: registryPath,
27+
stdio: 'inherit',
28+
},
29+
);
2630
}
2731

2832
// Token was generated using `echo -n 'testing:s3cret' | openssl base64`.

0 commit comments

Comments
 (0)