Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions __tests__/commands/install/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,3 +1039,16 @@ test.concurrent(
async (): Promise<void> => {
await runInstall({}, 'relative-symlinks-work', () => {});
});

test.concurrent('prunes the offline mirror after pruning is enabled', (): Promise<void> => {
return runInstall({}, 'prune-offline-mirror', async (config): Promise<void> => {
const mirrorPath = 'mirror-for-offline';
// Scenario:
// dep-a 1.0.0 was originally installed, and it depends on dep-b 1.0.0, so
// both of these were added to the offline mirror. Then dep-a was upgraded
// to 1.1.0 which doesn't depend on dep-b. After this, pruning was enabled,
// so the next install should remove dep-a-1.0.0.tgz and dep-b-1.0.0.tgz.
assert(!await fs.exists(path.join(config.cwd, `${mirrorPath}/dep-a-1.0.0.tgz`)));
assert(!await fs.exists(path.join(config.cwd, `${mirrorPath}/dep-b-1.0.0.tgz`)));
});
});
6 changes: 6 additions & 0 deletions __tests__/fixtures/install/prune-offline-mirror/.yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


yarn-offline-mirror "./mirror-for-offline"
yarn-offline-mirror-pruning true
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions __tests__/fixtures/install/prune-offline-mirror/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"dep-a": "1.1.0"
}
}
7 changes: 7 additions & 0 deletions __tests__/fixtures/install/prune-offline-mirror/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


dep-a@1.1.0:
version "1.1.0"
resolved dep-a-1.1.0.tgz#a347d002113da949bd89b6b71195ec3bca09db7a