question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new command: cypress cache prune

See original GitHub issue

When 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:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
GregLahayecommented, Feb 7, 2020

Would love to see this command added! Cypress cache is over 2GB now, installing every update since 3.5.0.

0reactions
cypress-bot[bot]commented, Oct 14, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Command Line - Cypress Documentation
To run a command, you'll need to prefix each command in order to properly locate the cypress executable. ... 5.4.0, Added prune subcommand...
Read more >
Clean Cypress cache in GitHub CI - Stack Overflow
You can use the command to delete all previously installed versions of cypress. cypress cache prune.
Read more >
cypress-page-object-model - NPM Package Overview - Socket
Cypress Page Object Basic Model ( Ready To Use ) - UI Test Automation Design ... Commands.add('getJobId', (text) => { const regex =...
Read more >
Cypress Tips and Tricks - Gleb Bahmutov
The command to run a specific spec file is cypress run --spec "spec/filename.js" by the way. Make JavaScript crashes useful #. As I...
Read more >
How to create custom Commands in Cypress? - YouTube
cypress #cypressAutomation #cypressCommandsCypress comes with its own API for creating custom commands and overwriting existing commands.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found