Skip to content

Conversation

@mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Dec 26, 2025

This pull request updates the clean script in the package.json files across multiple packages to improve how Jest's cache is cleared. The script now explicitly provides an empty config to the jest --clearCache command, 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:

  • Updated the clean script in the following package.json files to use jest --clearCache --config '{}' instead of just jest --clearCache, ensuring Jest does not look for a config file when clearing its cache:
    • packages/autocertifier-server/package.json
    • packages/cdn-location/package.json
    • packages/cli-tools/package.json
    • packages/dht/package.json
    • packages/geoip-location/package.json
    • packages/node/package.json
    • packages/proto-rpc/package.json
    • packages/sdk/package.json
    • packages/test-utils/package.json
    • packages/trackerless-network/package.json
    • packages/utils/package.json

This also noticeably speeds up the cleanup process.

Footnotes

  1. Configs can *become* invalid due to the processing order of the npm run … --workspaces command – clean command of the most "shared" test package (like test-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).

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.
@github-actions github-actions bot added network Related to Network Package test-utils Related to Test Utils Package cli-tools Related to CLI Tools Package dht Related to DHT package utils proto-rpc sdk node labels Dec 26, 2025
@mondoreale mondoreale requested a review from Copilot December 26, 2025 01:14
Copy link
Contributor

Copilot AI left a 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 || true to jest --clearCache --config '{}' across all packages
  • Removed error suppression (|| true) from the Jest command while keeping it on the rm -rf commands

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.

Copy link
Contributor

Copilot AI left a 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.

@mondoreale mondoreale merged commit 89448bc into main Dec 26, 2025
48 of 49 checks passed
@mondoreale mondoreale deleted the clean-jest-cache-without-config-validation branch December 26, 2025 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-tools Related to CLI Tools Package dht Related to DHT package network Related to Network Package node proto-rpc sdk test-utils Related to Test Utils Package utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants