From 1b473456f25f355dd089a8499037b21b95aeef97 Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Fri, 27 Oct 2023 09:15:12 +0200 Subject: [PATCH] fix(ci): use `YARN_ENABLE_IMMUTABLE_INSTALLS` when installing packages --- jest/helpers.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jest/helpers.ts b/jest/helpers.ts index 3b19322b3c..4b7d8797f0 100644 --- a/jest/helpers.ts +++ b/jest/helpers.ts @@ -28,6 +28,9 @@ export function runCLI( return spawnScript(process.execPath, [CLI_PATH, ...(args || [])], { ...options, cwd: dir, + env: { + YARN_ENABLE_IMMUTABLE_INSTALLS: 'false', + }, }); } @@ -92,6 +95,7 @@ export const getTempDirectory = (name: string) => type SpawnOptions = RunOptions & { cwd: string; + env?: {[key: string]: string | undefined}; }; type SpawnFunction = ( @@ -117,7 +121,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; @@ -126,6 +130,13 @@ function getExecaOptions(options: SpawnOptions) { env.NODE_PATH = options.nodePath; } + if (options.env) { + env = { + ...env, + ...options.env, + }; + } + return { cwd, env,