Skip to content

Commit ed4db6e

Browse files
test: give each Jest worker its own Yarn cache in the generator tests
The init, loader and plugin tests install with Yarn in parallel Jest workers. Yarn 1 can't fill one cache from two installs at the same time, and an install failed on macOS CI reading a half-written package.json from the shared cache. Claude-Session: https://claude.ai/code/session_013FhutRFjuQemBzekJMYcqL
1 parent f3c80dd commit ed4db6e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎test/create-webpack-app/test.utils.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use strict";
22

3+
const os = require("node:os");
34
const path = require("node:path");
45
const testUtilsPkg = require("../utils/test-utils");
56

@@ -15,6 +16,12 @@ const packageManagerEnv = {
1516
npm_config_audit: "false",
1617
npm_config_fund: "false",
1718
npm_config_update_notifier: "false",
19+
// Yarn 1 breaks its cache when two installs fill it at the same time, as tests in parallel
20+
// Jest workers do, so each worker gets its own
21+
YARN_CACHE_FOLDER: path.join(
22+
os.tmpdir(),
23+
`webpack-cli-yarn-cache-${process.env.JEST_WORKER_ID || 1}`,
24+
),
1825
};
1926

2027
/**

0 commit comments

Comments
 (0)