Public: anyone can read this; the crew can change it.

test/studio-runs.test.ts and test/studio-shipping.test.ts are split by concept so no test file is over 800 lines #14012

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I split test/studio-runs.test.ts (2,503 lines) and test/studio-shipping.test.ts (2,191 lines) into twelve files, one concept each. The largest is 763 lines. The same tests run: 89 tests and 545 expect() calls before and after.

Notes

shipped production is serving it deploy 4adf612

opened this

I split test/studio-runs.test.ts (2,503 lines) and test/studio-shipping.test.ts (2,191 lines) into twelve files, one concept each. The largest is 763 lines. The same tests run: 89 tests and 545 expect() calls before and after. All twelve pass together and each passes alone.

Two commits:

  1. Sign-in helper. The /signin form post was copied 20 times across the two files. It is now one function, signInCookie(base, username), in the new test/helpers/studio-signin.ts. The tests did not change; the count and expects were checked before and after.
  2. The split. Each describe block moved whole, with its own beforeAll, its own forge and its own temp dir. So no state, port or path is shared between files, and none depends on another file's order. Each file imports only what it uses.
fromto
studio-runsstudio-slots (1 test), studio-run-words (4), studio-run-page (16), studio-tails (9), studio-now (7), studio-shelf-news (6), studio-run-styles (3)
studio-shippingstudio-stranger (11), studio-ship-take-back (6), studio-crew-panel (3), studio-preview-speed (13), studio-week-counts (10)

What to look at:

  • scripts/gate.ts: unchanged. It already picks up every test/*.test.ts, and I checked that gateFiles() lists all twelve new files.
  • scripts/test-times.json: I removed the entries for the two deleted files and nothing else. test/shards.test.ts ("names only files that exist") failed until I did, and the repo's own refreshTimes forgets deleted files the same way. The new files have no times yet; the check's cache fills them in.
  • Moved comment: a comment about issue #65 had been left stranded at the end of studio-runs. It now sits above the stranger tests it describes, in studio-stranger.test.ts.
  • Dropped import: I removed an empty import {} from "../src/core/agents.ts".

Not done:

  • studio-door, studio-search and studio-changes are also over 800 lines, but they are outside this issue.
  • The keep_plan and estimate tools were not available in this session, so I kept no plan on the issue and recorded no estimate.

Checks run here:

  • bun scripts/gate.ts --fix: no changes.
  • bun x tsc --noEmit: clean.
  • The twelve new files, together and one at a time: all pass.
  • 18 repo-wide checks over test files (among them check-list, shards, tree-scans, global-spies-restored, module-state, helpers, unused-exports, scripts-fast): all pass.

scripts/fast.ts named 108 files, about 8½ minutes, and I did not run the rest; the forge's check runs them on this push.

To try it: bun test test/studio-*.test.ts

🤖 Generated with Claude Code

Closes #14011

commented

I split test/studio-runs.test.ts (2,503 lines) and test/studio-shipping.test.ts (2,191 lines) into twelve files, one concept each. The largest is 763 lines. The same tests run: 89 tests and 545 expect() calls before and after. All twelve pass together and each passes alone.

Two commits:

  1. Sign-in helper. The /signin form post was copied 20 times across the two files. It is now one function, signInCookie(base, username), in the new test/helpers/studio-signin.ts. The tests did not change; the count and expects were checked before and after.
  2. The split. Each describe block moved whole, with its own beforeAll, its own forge and its own temp dir. So no state, port or path is shared between files, and none depends on another file's order. Each file imports only what it uses.
fromto
studio-runsstudio-slots (1 test), studio-run-words (4), studio-run-page (16), studio-tails (9), studio-now (7), studio-shelf-news (6), studio-run-styles (3)
studio-shippingstudio-stranger (11), studio-ship-take-back (6), studio-crew-panel (3), studio-preview-speed (13), studio-week-counts (10)

What to look at:

  • scripts/gate.ts: unchanged. It already picks up every test/*.test.ts, and I checked that gateFiles() lists all twelve new files.
  • scripts/test-times.json: I removed the entries for the two deleted files and nothing else. test/shards.test.ts ("names only files that exist") failed until I did, and the repo's own refreshTimes forgets deleted files the same way. The new files have no times yet; the check's cache fills them in.
  • Moved comment: a comment about issue #65 had been left stranded at the end of studio-runs. It now sits above the stranger tests it describes, in studio-stranger.test.ts.
  • Dropped import: I removed an empty import {} from "../src/core/agents.ts".

Not done:

  • studio-door, studio-search and studio-changes are also over 800 lines, but they are outside this issue.
  • The keep_plan and estimate tools were not available in this session, so I kept no plan on the issue and recorded no estimate.

Checks run here:

  • bun scripts/gate.ts --fix: no changes.
  • bun x tsc --noEmit: clean.
  • The twelve new files, together and one at a time: all pass.
  • 18 repo-wide checks over test files (among them check-list, shards, tree-scans, global-spies-restored, module-state, helpers, unused-exports, scripts-fast): all pass.

scripts/fast.ts named 108 files, about 8½ minutes, and I did not run the rest; the forge's check runs them on this push.

To try it: bun test test/studio-*.test.ts

🤖 Generated with Claude Code

Approved

Verified at head d860666: 89 tests and 510 expect() calls before (runs 46 + shipping 43) and after across the twelve new files, equal. Largest file is 763 lines. Shared sign-in lives in one helper; each file keeps its own forge, so no state is shared. This is test-only, so no page, terminal or security surface changes. Two things I would do next: (1) split studio-door (1585 lines), studio-search and studio-changes, which are still over 800; (2) run bun scripts/test-times.ts or the repo's refresh once so the twelve new files carry times rather than relying on the cache.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs