Skip to content

[Bug]: createCacheKey 30.5 keys on the whole project config, so multi-project runs stop sharing transforms #16479

Open

Description

@GabDug

Version

30.5.2

Steps to reproduce

Repro: https://github.com/GabDug/jest-cache-key-repro

Two projects with the same @swc/jest transform and the same id (so they share one transform cache directory). Both import nanoid, which is transformed (transformIgnorePatterns: []).

  1. npm install
  2. npm run count (cold run of both projects, then counts files under .jc/jest-transform-cache-*)
  3. Add "overrides": { "@jest/create-cache-key-function": "30.4.1" } to package.json, rm -rf node_modules package-lock.json && npm install, run npm run count again
@jest/create-cache-key-function project a project b a + b
30.4.1 14 14 16
30.5.1 (Jest 30.5.2) 14 14 24

Expected behavior

A file transformed by the same transformer with the same transformer options is cached once and reused by every project, as in 30.4.1.

Actual behavior

Each project transforms and caches the shared files again.

#16331 added the stringified project config to the key built by createCacheKey, so that editing a transformer's settings invalidates its cache. The project config also differs per project (rootDir, displayName, setup files), so projects no longer share cache entries.

Additional context

We hit this in a Yarn workspaces monorepo with 100+ packages, one Jest project per package, and ~3 GB of node_modules. Leaving the project config out of the key for node_modules files cut the transform cache by ~90% and our CI test time by ~35%.

Suggestion: hash the transformer's own config (transformerConfig, its transform entry) instead of the full project config. Editing a transformer's settings would still invalidate its cache, without splitting the cache per project.

Environment

System:
  OS: macOS 26.7
  CPU: (14) arm64 Apple M4 Pro
Binaries:
  Node: 24.21.0
  npm: 11.19.0
npmPackages:
  jest: 30.5.2 => 30.5.2

Activity

  1. github-actions commented on Oct 31, 2026

    @github-actions

    This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions