Skip to content

Commit dac4eda

Browse files
committed
recreate the envrionment in a durable way
1 parent f8d6b75 commit dac4eda

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

jest/helpers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,14 @@ function getExecaOptions(options: SpawnOptions) {
132132

133133
const cwd = isRelative ? path.resolve(__dirname, options.cwd) : options.cwd;
134134

135+
const localBin = path.resolve(cwd, 'node_modules/.bin');
136+
137+
// Merge the existing environment with the new one
135138
let env = Object.assign({}, process.env, {FORCE_COLOR: '0'}, options.env);
136139

140+
// Prepend the local node_modules/.bin to the PATH
141+
env.PATH = `${localBin}${path.delimiter}${env.PATH}`;
142+
137143
if (options.nodeOptions) {
138144
env.NODE_OPTIONS = options.nodeOptions;
139145
}

0 commit comments

Comments
 (0)