Repository navigation
fix(tests): fix typecheck:test regression + add root CI quality gate - #12
Merged
Merged
Conversation
The Jest Worker-globals shim declared `webSocket: unknown`, which conflicts with the Workers `Response.webSocket: WebSocket | null` base type. ts-jest strips types (so tests pass) but `npm run typecheck:test` fails with TS2416. Align the property type and cast the assignment. Co-authored-by: Cursor <cursoragent@cursor.com>
There was no CI running the root project's checks on PRs (only the path-scoped crypto-payments workflow), which is why the typecheck:test regression fixed in this branch slipped in. Add a hermetic gate that runs the three typecheck surfaces (Worker source, local Node runtime, tests) plus the unit and integration suites on every PR/push to main. e2e (Playwright/wrangler) and the coverage threshold are intentionally left out for now: e2e needs workerd + secrets, and branch coverage currently sits below the configured 80% gate (a separate follow-up). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related changes:
typecheck:test— the Jest Worker-globals shim (added in fix(tests): repair Jest ESM/Workers test environment + unmask two real bugs #10) declaredWorkerResponse.webSocket: unknown, conflicting with the WorkersResponse.webSocket: WebSocket | nullbase type (TS2416). ts-jest strips types (so tests passed) butnpm run typecheck:testwas red onmain. Typed the property toWebSocket | nulland cast the assignment..github/workflows/ci.yml) so this class of regression is caught automatically. It runs on every PR/push tomain:typecheck(Worker source)typecheck:node(local Node runtime)typecheck:test(tests)test:unit+test:integrationPreviously the only workflow was the path-scoped
crypto-payments-ci.yml, so nothing validated the root project on PRs — which is exactly why the regression slipped in.Verification (local)
npm run typecheck/typecheck:node/typecheck:test→ all PASS (was FAIL)npm run test:unit→ 152/152 ·npm run test:integration→ 6/6Deliberately out of scope (follow-ups)
wrangler dev/workerd and needs secrets; better as a separate secret-aware job.jest.config.ts), a pre-existing gap from the platform-agnostic code. Either add branch tests or adjust the threshold; not gated here to avoid shipping a red pipeline.Test plan
CI / quality-gatecheck passes on this PR.