Skip to content

Commit

Permalink
fix(ci): use YARN_ENABLE_IMMUTABLE_INSTALLS when installing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonrybczak committed Nov 2, 2023
1 parent 33ff1d7 commit a8af0aa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion jest/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export function runCLI(
return spawnScript(process.execPath, [CLI_PATH, ...(args || [])], {
...options,
cwd: dir,
env: {
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false',
},
});
}

Expand Down Expand Up @@ -125,6 +128,7 @@ export const getTempDirectory = (name: string) =>

type SpawnOptions = RunOptions & {
cwd: string;
env?: {[key: string]: string | undefined};
};

type SpawnFunction<T> = (
Expand Down Expand Up @@ -163,7 +167,7 @@ function getExecaOptions(options: SpawnOptions) {

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

const env = Object.assign({}, process.env, {FORCE_COLOR: '0'});
let env = Object.assign({}, process.env, {FORCE_COLOR: '0'});

if (options.nodeOptions) {
env.NODE_OPTIONS = options.nodeOptions;
Expand All @@ -172,6 +176,13 @@ function getExecaOptions(options: SpawnOptions) {
env.NODE_PATH = options.nodePath;
}

if (options.env) {
env = {
...env,
...options.env,
};
}

return {
cwd,
env,
Expand Down

0 comments on commit a8af0aa

Please sign in to comment.