Skip to content

test: add jest config, CI, and repair the suite - #3

Draft
janakiram7755 wants to merge 4 commits into
feat/v6-apifrom
feat/test-harness
Draft

test: add jest config, CI, and repair the suite#3
janakiram7755 wants to merge 4 commits into
feat/v6-apifrom
feat/test-harness

Conversation

@janakiram7755

Copy link
Copy Markdown
Collaborator

Stacked on #2. The repo had no jest config and no CI — both lived at the old monorepo root.

9/9 suites, 62/62 tests green.

Jest config follows upstream: ts-jest compiles to CommonJS for the test run while tsc builds lib/ as ESM. ESM namespaces are immutable so jest.spyOn cannot patch them; this keeps all 80 existing spyOn calls working with no restructuring. Same moduleNameMapper + transformIgnorePatterns approach they use.

Repaired tests, all of which were asserting upstream's old contract:

  • getCacheEntry(key, restoreKeys, paths, opts) — ours takes 4 args, not 3
  • reserveCache(key, chunks, version) — ours is positional, not an options object
  • downloadCache(provider, ...) — ours dispatches on provider; replaced the URL-based Azure/http-client tests with s3 / gcs-without-token / unknown-provider
  • ArtifactCacheEntry / ReserveCacheResponse no longer exist; fixtures now use the real CommonsGetCacheResponse / CommonsReserveCacheResponse
  • isFeatureAvailable reads WARPBUILD_RUNNER_VERIFICATION_TOKEN, not the cache URL
  • the getCacheVersion expectations were correct all along but omitted the 4th argument, which left process.arch in the hash and made them machine-dependent

Ref: actions/toolkit jest.config.js

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.

1 participant