Skip to content

fix(tests): fix typecheck:test regression + add root CI quality gate - #12

Merged
papismurf merged 2 commits into
mainfrom
fix/typecheck-test-response-type
Jul 9, 2026
Merged

papismurf merged 2 commits into
mainfrom
fix/typecheck-test-response-type

Conversation

@papismurf

@papismurf papismurf commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two related changes:

  1. Fix typecheck:test — the Jest Worker-globals shim (added in fix(tests): repair Jest ESM/Workers test environment + unmask two real bugs #10) declared WorkerResponse.webSocket: unknown, conflicting with the Workers Response.webSocket: WebSocket | null base type (TS2416). ts-jest strips types (so tests passed) but npm run typecheck:test was red on main. Typed the property to WebSocket | null and cast the assignment.
  2. Add a root CI workflow (.github/workflows/ci.yml) so this class of regression is caught automatically. It runs on every PR/push to main:
    • typecheck (Worker source)
    • typecheck:node (local Node runtime)
    • typecheck:test (tests)
    • test:unit + test:integration

Previously 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/6
  • Workflow YAML validated.

Deliberately out of scope (follow-ups)

  • e2e (Playwright) — boots wrangler dev/workerd and needs secrets; better as a separate secret-aware job.
  • Coverage gate — global branch coverage is currently 71.99% (below the configured 80% in 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

  • New CI / quality-gate check passes on this PR.

David Brown and others added 2 commits July 8, 2026 08:08
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>
@papismurf papismurf changed the title fix(tests): type WorkerResponse.webSocket to match base Response (fixes typecheck:test) fix(tests): fix typecheck:test regression + add root CI quality gate Jul 8, 2026
@papismurf
papismurf merged commit 5da3243 into main Jul 9, 2026
1 check passed
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