Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Developer never selects the browsers a test tool installed
Țugui Dragoșde0717d8dc85
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swiftindex e6a84d24..c3d988f2 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift@@ -12,7 +12,8 @@ public struct DeveloperEnvironment: Sendable, Hashable, Identifiable {case archives/// Model weights and datasets: large, slow to fetch again.case models- /// Installed sets of packages: virtual environments, editor plug-ins, language servers.+ /// Installed sets of packages: virtual environments, editor plug-ins, language servers, and the browsers a test+ /// tool installs, which it does not fetch again by itself.case environments/// What a tool keeps for the person to install again: installers, store packages, virtual machine boxes.case keptDownloads@@ -213,20 +214,20 @@ public enum DeveloperCaches {Folder(".cache/prisma", .downloads, source: "https://github.com/prisma/prisma/blob/7.10.0/packages/fetch-engine/src/utils.ts#L38-L40"),]),Definition(id: "playwright", name: "Playwright", systemImage: "globe", appBundleIdentifiers: [], folders: [- Folder("Library/Caches/ms-playwright", .downloads, source: "https://github.com/microsoft/playwright/blob/main/docs/src/browsers.md#L958"),+ Folder("Library/Caches/ms-playwright", .environments, source: "https://github.com/microsoft/playwright/blob/main/docs/src/browsers.md#L958"),]),Definition(id: "playwrightgo", name: "Playwright for Go", systemImage: "globe", appBundleIdentifiers: [], folders: [- Folder("Library/Caches/ms-playwright-go", .downloads, source: "https://github.com/playwright-community/playwright-go/blob/main/run.go#L370-L372"),+ Folder("Library/Caches/ms-playwright-go", .environments, source: "https://github.com/playwright-community/playwright-go/blob/main/run.go#L370-L372"),]),// The drivers and browsers Selenium Manager keeps, and not `se-config.toml`, its settings, beside them.Definition(id: "selenium", name: "Selenium Manager", systemImage: "globe", appBundleIdentifiers: [], folders: [Folder(".cache/selenium/*/", .downloads, source: "https://github.com/SeleniumHQ/seleniumhq.github.io/blob/trunk/website_and_docs/content/documentation/selenium_manager.en.md#L34"),]),Definition(id: "cypress", name: "Cypress", systemImage: "globe", appBundleIdentifiers: [], folders: [- Folder("Library/Caches/Cypress", .downloads, source: "https://github.com/cypress-io/cypress-documentation/blob/main/docs/app/get-started/advanced-installation.mdx#L615"),+ Folder("Library/Caches/Cypress", .environments, source: "https://github.com/cypress-io/cypress-documentation/blob/main/docs/app/get-started/advanced-installation.mdx#L615"),]),Definition(id: "puppeteer", name: "Puppeteer", systemImage: "globe", appBundleIdentifiers: [], folders: [- Folder(".cache/puppeteer", .downloads, source: "https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer/src/getConfiguration.ts#L162-L165"),+ Folder(".cache/puppeteer", .environments, source: "https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer/src/getConfiguration.ts#L162-L165"),]),Definition(id: "electron", name: "Electron", systemImage: "cube", appBundleIdentifiers: [], folders: [Folder("Library/Caches/electron", .downloads, source: "https://github.com/electron/get/blob/main/README.md#L123"),diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swiftindex 6a3fe3b6..f2fa2620 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift@@ -316,6 +316,22 @@ struct DeveloperCachesTests {#expect(locations.allSatisfy { $0.kind == .keptDownloads && !$0.isRecommended })}+ /// The browsers and binaries test tools install are not fetched again when they are gone: `npx playwright+ /// install`, Cypress's `postinstall` and `npx puppeteer browsers install` put them back. They are listed as+ /// installed packages and never selected.+ @Test func browsersATestToolInstalledAreNeverSelected() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("Library/Caches/ms-playwright/chromium-1200/chrome-mac/Chromium.bin", bytes: 400_000)+ try directory.file("Library/Caches/ms-playwright-go/1.50.0/node", bytes: 400_000)+ try directory.file("Library/Caches/Cypress/15.0.0/Cypress.bin", bytes: 400_000)+ try directory.file(".cache/puppeteer/chrome/mac_arm-140.0/chrome.bin", bytes: 400_000)++ let locations = await DeveloperCaches.scan(homeDirectory: directory.url).flatMap(\.locations)++ #expect(locations.count == 4)+ #expect(locations.allSatisfy { $0.kind == .environments && !$0.isRecommended })+ }+/// Peel reads cask definitions from Homebrew's `api` folder, which `brew cleanup` leaves alone too. It is/// never offered: without it, the next Homebrew question would go to the network.@Test func leavesHomebrewsCopyOfTheCaskDefinitions() async throws {