Skip to content

Commit 18ae133

Browse files
committed
Separate cache for build commands
1 parent a43ba45 commit 18ae133

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/e2e-tests/lib/buildApp.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-console */
22

33
import * as fs from 'fs-extra';
4+
import * as os from 'os';
45
import * as path from 'path';
56

67
import { DEFAULT_BUILD_TIMEOUT_SECONDS } from './constants';
@@ -28,12 +29,15 @@ export async function buildApp(appDir: string, recipeInstance: RecipeInstance, e
2829
if (recipe.buildCommand) {
2930
console.log(`Running build command for test application "${label}"`);
3031

32+
const tempYarnCache = fs.mkdtempSync(path.join(os.tmpdir(), 'e2e-test-build-yarn-cache-temp-dir-'));
33+
3134
const buildResult = await spawnAsync(recipe.buildCommand, {
3235
cwd: appDir,
3336
timeout: (recipe.buildTimeoutSeconds ?? DEFAULT_BUILD_TIMEOUT_SECONDS) * 1000,
3437
env: {
3538
...process.env,
3639
...env,
40+
YARN_CACHE_FOLDER: tempYarnCache, // Use a separate yarn cache for each build commmand because multiple yarn commands running at the same time may corrupt the cache
3741
} as unknown as NodeJS.ProcessEnv,
3842
});
3943

0 commit comments

Comments
 (0)