test: fix api guardian tests on windows when node_modules are not installed (#30105)
When the workspace node_modules are not installed outside of bazel context the api guardian tests fails because the tree artifacts files are not symlinked in windows. We need to pass the node module location in the node_path PR Close #30105
This commit is contained in:
parent
bdc6818716
commit
10705684c8
|
@ -124,7 +124,11 @@ function execute(args: string[]): {stdout: string, stderr: string, status: numbe
|
|||
// We need to determine the directory that includes the `ts-api-guardian` npm_package that
|
||||
// will be used to spawn the CLI binary. This is a workaround because technically we shouldn't
|
||||
// spawn a child process that doesn't have the custom NodeJS module resolution for Bazel.
|
||||
const nodePath = path.join(path.dirname(require.resolve('../lib/cli.js')), '../');
|
||||
const nodePath = [
|
||||
path.join(require.resolve('npm/node_modules/chalk/package.json'), '../../'),
|
||||
path.join(require.resolve('../lib/cli.js'), '../../'),
|
||||
].join(process.platform === 'win32' ? ';' : ':');
|
||||
|
||||
const output = child_process.spawnSync(process.execPath, [BINARY_PATH, ...args], {
|
||||
env: {
|
||||
'NODE_PATH': nodePath,
|
||||
|
|
Loading…
Reference in New Issue