-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): skip cache cleanup when enableGlobalCache is true (#4402)
* skip cache cleanup when enableGlobalCache is true * patch notes * chore: versions * move guard * only move enableGlobalCache check * missed this in cleanup * Update Project.ts Co-authored-by: merceyz <[email protected]> Co-authored-by: Maël Nison <[email protected]>
- Loading branch information
1 parent
0eb915f
commit 8e0c4b8
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
releases: | ||
"@yarnpkg/cli": patch | ||
"@yarnpkg/core": patch | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-exec" | ||
- "@yarnpkg/plugin-file" | ||
- "@yarnpkg/plugin-git" | ||
- "@yarnpkg/plugin-github" | ||
- "@yarnpkg/plugin-http" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-link" | ||
- "@yarnpkg/plugin-nm" | ||
- "@yarnpkg/plugin-npm" | ||
- "@yarnpkg/plugin-npm-cli" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-pnpm" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/doctor" | ||
- "@yarnpkg/nm" | ||
- "@yarnpkg/pnpify" | ||
- "@yarnpkg/sdks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,6 +564,31 @@ describe(`Commands`, () => { | |
expect(postUpgradeCache.find(entry => entry.includes(`no-deps-npm-2.0.0`))).toBeDefined(); | ||
})); | ||
|
||
test(`it should not clean the cache when cache lives inside the project but global cache is set`, makeTemporaryEnv({ | ||
dependencies: { | ||
[`no-deps`]: `1.0.0`, | ||
}, | ||
}, async ({path, run, source}) => { | ||
const env = { | ||
YARN_ENABLE_GLOBAL_CACHE: `true`, | ||
YARN_GLOBAL_FOLDER: `${path}/global`, | ||
}; | ||
await run(`install`, {env}); | ||
|
||
const preUpgradeCache = await xfs.readdirPromise(`${path}/global/cache` as PortablePath); | ||
|
||
expect(preUpgradeCache.find(entry => entry.includes(`no-deps-npm-1.0.0`))).toBeDefined(); | ||
|
||
const {code, stdout, stderr} = await run(`add`, `[email protected]`, {env}); | ||
|
||
await expect({code, stdout, stderr}).toMatchSnapshot(); | ||
|
||
const postUpgradeCache = await xfs.readdirPromise(`${path}/global/cache` as PortablePath); | ||
|
||
expect(postUpgradeCache.find(entry => entry.includes(`no-deps-npm-1.0.0`))).toBeDefined(); | ||
expect(postUpgradeCache.find(entry => entry.includes(`no-deps-npm-2.0.0`))).toBeDefined(); | ||
})); | ||
|
||
test(`it should not clean the cache when cache lives outside the project`, makeTemporaryEnv({ | ||
dependencies: { | ||
[`no-deps`]: `1.0.0`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters