Skip to content

Port the unit tests and their harness to strict TypeScript (TS16) - #27

Merged
Finesssee merged 2 commits into
mainfrom
ts/ts16-unit-tests
Oct 11, 2026
Merged

Finesssee merged 2 commits into
mainfrom
ts/ts16-unit-tests

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

What

Ports the unit tests and their harness to strict TypeScript (TS16 in the port plan). Viewers, streamers and the overlay see no change: the build output is byte-identical to main (port-check: 155 build output files compared, 0 different; the served hash stays 15ab3b21f0).

  • tests/*.test.mjs, tests/register.mjs, tests/cloudflare-test-loader.mjs, tests/csp-helper.mjs and tests/upload-helpers.mjs become .ts. test:unit runs tests/*.test.ts.
  • tests/fakes.ts holds one SQLite Durable Object fake (fakeCtx() on node:sqlite) in place of the copies in channel, dev-api, dedupe and upload-helpers, plus asEnv(), asExecutionContext(), must() and Loose.
  • Two new strict programs:
    • tsconfig.strict-tests.json holds tests that import DOM modules only.
    • tsconfig.strict-tests-shared.json holds tests that import both Worker and DOM modules.
    • port-check --strict-list accepts all four lists.
  • tests/atlas.test.ts (split from upload) and tests/cosmetics.test.ts (split from channel) are new files. Test names and count are unchanged.
  • SendResult moved from server/eventsub.ts to server/model.ts. Otherwise server/parse.ts pulled eventsub's Web Crypto code into the shared test program, where it doesn't type-check under Node's typed-array types. This is type-only.
  • src/served/overlay.ts: let lookTimer: unknown = 0. This is type-only (both ReturnType forms failed oxlint's type-aware rules).

Checks

  • bun run check: 343 of 343 pass. The test names match main's, except cosmetic ids: … (src/served/cosmetics.js) now reads .ts.
  • bun run test:port: 100 of 100. A new fixture covers a file listed only in tsconfig.strict-tests.json.
  • Red checks:
    • Making parseGameCommand return null fails 70 of 326 tests.
    • Making botCommand answer 204 first fails 17 of 326 tests.
  • Casts in tests: 150 as (as unknown as counts as two), 0 !, and one any (the Loose alias). Each has a reason on its line or the line above.

Left for later

  • Production types that look too strict and are cast around in the tests:
    • seReplyText requires origin.
    • shownProfile rejects null.
    • ProfileInput.stats requires full Stats.
    • tierBoost requires its second argument.
    • Duel has no paid field.
    • reviewReasons requires a full HelixUser.
  • Stale paths:
    • public/_headers:2.
    • The comment at src/served/cosmetics.ts:2, which has to stay byte-identical. It goes to TS21.
    • The fixture strings under tests/port, which go to TS17.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: nesszer/pixfray/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 930596e5-bd07-423c-a509-8529ab57adca

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee
Finesssee merged commit e85836e into main Oct 11, 2026
3 checks 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