Skip to content

test(cli): Derive cache clean test path from CACHE_VERSION - #1495

Merged
RandomByte merged 1 commit into
mainfrom
test/cache-version-not-hardcoded
Aug 4, 2026
Merged

test(cli): Derive cache clean test path from CACHE_VERSION#1495
RandomByte merged 1 commit into
mainfrom
test/cache-version-not-hardcoded

Conversation

@RandomByte

@RandomByte RandomByte commented Aug 3, 2026

Copy link
Copy Markdown
Member

Problem

test/lib/cli/commands/cache.js fully mocks CacheManager, so the real CACHE_VERSION never runs. The "buildCache/v0_7" literals were self-consistent stub data: a version bump in CacheManager.js would leave them stale without failing any assertion.

Change

  • Export CACHE_VERSION from CacheManager.js (the ./internal/build/cache/CacheManager entry point already exists).
  • Import it in the test and derive BUILD_CACHE_PATH = `buildCache/${CACHE_VERSION}` , replacing the hardcoded literals so the test stays in sync on a version bump.

The one "buildCache/v0_6" remains literal on purpose: it simulates an older, stale cache directory distinct from the current version.

Export CACHE_VERSION from CacheManager and build the test's buildCache path
from it, so the mocked test stays in sync when the version is bumped.
@RandomByte
RandomByte marked this pull request as ready for review August 3, 2026 09:43
@RandomByte
RandomByte requested a review from a team August 3, 2026 09:43
@RandomByte
RandomByte merged commit 22672ad into main Aug 4, 2026
60 checks passed
@RandomByte
RandomByte deleted the test/cache-version-not-hardcoded branch August 4, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants