-
Notifications
You must be signed in to change notification settings - Fork 43
refactor: Clear jest's cache without validating jest configs #3312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It still clears the default cache directory and yet, the config can be invalid due to missing files in packages associated to the currently processed one… due to the processing order of the `npm run … --workspaces` command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the clean script across 11 package.json files to improve Jest cache clearing by providing an empty configuration object. This change prevents Jest from validating config files during cache clearing, which addresses issues where configs may be temporarily invalid during monorepo cleanup operations.
Key changes:
- Updated
jest --clearCache || truetojest --clearCache --config '{}'across all packages - Removed error suppression (
|| true) from the Jest command while keeping it on therm -rfcommands
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/autocertifier-server/package.json | Updated clean script to use empty Jest config |
| packages/cdn-location/package.json | Updated clean script to use empty Jest config |
| packages/cli-tools/package.json | Updated clean script to use empty Jest config |
| packages/dht/package.json | Updated clean script to use empty Jest config |
| packages/geoip-location/package.json | Updated clean script to use empty Jest config |
| packages/node/package.json | Updated clean script to use empty Jest config |
| packages/proto-rpc/package.json | Updated clean script to use empty Jest config |
| packages/sdk/package.json | Updated clean script to use empty Jest config |
| packages/test-utils/package.json | Updated clean script to use empty Jest config |
| packages/trackerless-network/package.json | Updated clean script to use empty Jest config |
| packages/utils/package.json | Updated clean script to use empty Jest config |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request updates the
cleanscript in thepackage.jsonfiles across multiple packages to improve how Jest's cache is cleared. The script now explicitly provides an empty config to thejest --clearCachecommand, which helps prevent issues if a local or default Jest config is missing or incompatible.Important
It still clears the default cache directory, but! it does not care about config file validity.1
Changes
Script improvements across all packages:
cleanscript in the followingpackage.jsonfiles to usejest --clearCache --config '{}'instead of justjest --clearCache, ensuring Jest does not look for a config file when clearing its cache:packages/autocertifier-server/package.jsonpackages/cdn-location/package.jsonpackages/cli-tools/package.jsonpackages/dht/package.jsonpackages/geoip-location/package.jsonpackages/node/package.jsonpackages/proto-rpc/package.jsonpackages/sdk/package.jsonpackages/test-utils/package.jsonpackages/trackerless-network/package.jsonpackages/utils/package.jsonThis also noticeably speeds up the cleanup process.
Footnotes
Configs can *become* invalid due to the processing order of the
npm run … --workspacescommand –cleancommand of the most "shared" test package (liketest-utils) gets called first which may (will) in the future cause deletion of its jest setup files used by some packages in their jest setups (like custom matchers). ↩