Skip to content

test(dx): headless API test runner, unit-test aggregate, typecheck, CI (TODO 15) - #123

Closed
lopugit wants to merge 2 commits into
mainfrom
claude/todo15-headless-tests-ci-s3
Closed

test(dx): headless API test runner, unit-test aggregate, typecheck, CI (TODO 15)#123
lopugit wants to merge 2 commits into
mainfrom
claude/todo15-headless-tests-ci-s3

Conversation

@lopugit

@lopugit lopugit commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Ships the runnable core of TODO 15 — 🛠️ DX ratchet: add typecheck, a headless test runner, and CI.

What

Piece Detail
scripts/run-api-tests.mjs Headless HTTP runner that reuses the same apiTests.ts + apiTestRunner.ts the interactive /tests page uses — one source of truth. Shims window.setTimeout/clearTimeout and resolves the app's relative fetch paths against --base.
scripts/ts-alias-loader.mjs + register-ts-hook.mjs Tiny ESM resolve hook (~/ alias + extensionless .ts) so plain node runs the TS test modules.
package.json typecheck (tsc --noEmit), test (all four unit suites), test:api; the four test:* suites now load the hook.
.github/workflows/ci.yml PR + push-to-main gate: pnpm install → unit tests → build:client. Typecheck runs non-blocking.

Runner flags

--base <url> · --group <g> (repeatable) · --all (include mutating/email tests — off by default so a bare run is read-only) · --json. Exits non-zero on any failure.

Bonus fix

The hook also fixes the previously-broken test:editorjs suite, which failed on main because node --test couldn't resolve editorJsValue.ts's extensionless ./inlineHtmlText import. npm run test was red on main; it's green now.

Why typecheck is non-blocking

tsc --noEmit currently reports ~121 errors (strict mode is off in tsconfig). The step surfaces the count so it can be ratcheted down over time rather than blocking every PR on a pre-existing backlog — exactly the TODO's "progressively enable strictness" intent.

Verification (local)

  • npm run test87/87 across the 4 unit suites, exit 0
  • run-api-tests.mjs against a live dev server → 224/226 (the 2 are per-IP rate-limit 429s from my repeated runs — the runner correctly exercises the real limiter, not real failures)
  • npm run build:client → succeeds
  • npm run typecheck → exit 2 (expected; non-blocking in CI)
  • --json output and --group filter verified

Deferred (explicitly out of scope, noted in TODO 15)

Enabling tsc strictness, unifying the two drifted ThingtimeTypes interfaces, and finishing the Commander V1→V2 migration — each is its own change. The API runner is not run in CI (needs a live server + MongoDB); it's a local/staging tool.

Session 3 of 10 parallel todo sessions (previous: #94, #102, #105, #112, #117); claim branch pushed before work started.

🤖 Generated with Claude Code

…I (TODO 15)

The 226-test API suite only ran from the interactive /tests page, four
node --test unit suites had no aggregate, there was no typecheck script,
and no CI. Adds the ratchet's runnable core:

- scripts/run-api-tests.mjs: headless HTTP runner that reuses the SAME
  canonical apiTests.ts + apiTestRunner.ts the browser uses (one source
  of truth). Shims window.setTimeout/clearTimeout and resolves the app's
  relative fetch paths against a --base origin. Flags: --base, --group
  (repeatable), --all (include mutating/email tests, off by default so a
  bare run is read-only), --json. Exits non-zero on failure.
- scripts/ts-alias-loader.mjs + register-ts-hook.mjs: a tiny ESM resolve
  hook (~/ alias + extensionless .ts) so plain node can run the TS test
  modules. This ALSO fixes the previously-broken test:editorjs suite,
  which failed on main because node --test couldn't resolve
  editorJsValue.ts's extensionless './inlineHtmlText' import.
- package.json: typecheck (tsc --noEmit), test (runs all four unit
  suites), test:api; the four test:* suites now load the resolve hook.
- .github/workflows/ci.yml: PR + push-to-main gate — pnpm install, unit
  tests, build:client. Typecheck runs non-blocking (tsc currently reports
  ~121 baseline errors, strict off — a number to ratchet down).

Verified locally: npm run test → 87/87 across 4 suites, exit 0;
run-api-tests against a live dev server → 224/226 (the 2 are per-IP
rate-limit 429s from repeated local runs, not real failures);
build:client succeeds; typecheck exits 2 as expected (non-blocking).

Deferred (called out in TODO 15, not in this PR): enabling tsc
strictness, unifying the drifted ThingtimeTypes interfaces, finishing the
Commander V1->V2 migration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thingtime Ready Ready Preview, Comment Jul 26, 2026 9:30am

Request Review

Comment thread .github/workflows/ci.yml
Comment on lines +21 to +53
runs-on: ubuntu-latest
defaults:
run:
working-directory: remix
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.1

- name: Setup Node
uses: actions/setup-node@v4
with:
# Node >= 23.6 runs the repo's `node --test *.test.ts` suites
# directly (TypeScript type-stripping on by default).
node-version: 24
cache: pnpm
cache-dependency-path: remix/pnpm-lock.yaml

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Unit tests
run: npm run test

- name: Typecheck (non-blocking)
continue-on-error: true
run: npm run typecheck

- name: Build client shell
run: npm run build:client
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Could not auto-resolve conflicts with main — manual resolution needed. See the workflow run.

Conflicted files (as recorded by the merge step):

  • remix/package.json

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Could not auto-resolve conflicts with main — manual resolution needed. See the workflow run.

Conflicted files (as recorded by the merge step):

  • remix/package.json

lopugit added a commit that referenced this pull request Jul 29, 2026
…te, single Web CI

Absorbs the best of the parallel PRs #119, #123, and #126 into this branch
(#121), so one PR carries TODO item 15:

- typecheck ratchet (from #126): scripts/typecheck-ratchet.mjs +
  typecheck-baseline.json (134 errors today) — CI fails only when the tsc
  error count grows, and --update-baseline locks in reductions.
- test:unit aggregate (from #119/#123), with the node --test suites loading
  through tsx instead of a hand-rolled resolve hook — fixes the previously
  broken ~/-alias suites and adds the scriptless mongodb/*.test.ts suite
  (109 unit tests, all passing).
- runner --list flag (parity with the other runners).
- TODO.md item-15 status note (from #123, updated).
- one workflow: api-tests.yml + the others' ci.yml variants become
  web-ci.yml — build + ratchet + unit tests, plus the headless 243-test API
  suite against a real Vite + Nitro + Mongo stack; path-filtered to remix/**,
  read-only token, node 24.

Verified locally: ratchet at baseline, 109/109 unit tests, 243/243 API tests
against a live dev stack.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lopugit

lopugit commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

Consolidated into #121 at Lopu's request (one PR for TODO 15). Your unit-test aggregate, TODO.md status note, and the editorjs-suite fix were carried over (the alias loader became tsx, which the runner already needed) — credited in #121's body. Thanks!

@lopugit lopugit closed this Jul 29, 2026
lopugit added a commit that referenced this pull request Aug 7, 2026
dx: headless API test runner, typecheck ratchet, unit aggregate + Web CI (TODO 15, consolidates #119/#123/#126)
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