Add new command: cypress cache prune
See original GitHub issueWhen caching Cypress binary on CI, it is easy to start carrying LOTS of installed binary versions, increasing cache size and time it takes to restore cache on each CI build.
Situation
Imagine you start using Cypress v3.5.0 and cache ~/.cache
folder like we advise in https://on.cypress.io/caching. Initially, you will have just v3.5.0 there.
Then you upgrade to v3.6.0 in package.json
file. The CI build does the following
- restores the existing
~/.cache
folder with 3.5.0 - installs v3.6.0. Now
~/.cache
has both 3.5.0 and 3.6.0 - saves the
~/.cache
folder as new cache
Boom, after a few version upgrades you have lots of old binary versions, making cache size easily pass 1GB
Commands
In current Cypress version v3.8.0 we have the following commands related to the binary cache
$ npx cypress cache
Usage: cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
-h, --help output usage information
I propose we add one more command cypress cache prune
that removes all versions from the binary cache folder but the current one. Then one could run this command on CI like this
- restore cache folder
- npm install
- npx cypress verify
- npx cypress cache prune
- save cache folder
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:5 (3 by maintainers)
Would love to see this command added! Cypress cache is over 2GB now, installing every update since 3.5.0.
Released in
5.4.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v5.4.0, please open a new issue.