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

forked from trevato/cs

What ships is what runs, for the shooter too: the committed app bundle boots under the stub page #43

shipped production is serving it opened this has it
opened this

src/range/bundle.test.ts proves the range's minified file boots; nothing proves static/app.<hash>.js does, and that is the file a browser actually downloads. #27 gave the client the stub page this needs.

Done looks like

  • [ ] src/client/bundle.test.ts installs the stubs from src/client/stage.test-helper.ts, finds the committed bundle with isBundleOf("app", …) from scripts/build.ts, and imports it by file:// URL.
  • [ ] With no WebGL context the page ends up saying so — the same sentence main.test.ts pins — and nothing throws.
  • [ ] With the stub context the boot finds the shell's ids (scene, hud, fps, touch, play, name, length, side, sens), and a click on play starts a match: at least one frame runs and draws through the recording Paint.
  • [ ] The test fails when the bundle is stale or truncated. Say how you checked — pointing it at an edited copy for one run is enough.
  • [ ] It needs no network, no database and no FORGE_APP_*, restores every global it installs, and adds well under a second to bun test.
  • [ ] The "find the committed bundle and import it" step lives in one place, shared with src/range/bundle.test.ts, rather than copied.

Files I expect to change

src/client/bundle.test.ts (new), src/client/stage.test-helper.ts (exports only, no behaviour change), src/range/bundle.test.ts (to share the helper), README.md (a line in the testing paragraph, if it names the others).

Risks

A minified bundle exposes nothing to poke: hold it to what it does to the stub DOM and nothing else. The entry calls boot() at import time unless readyState is "loading", so the stub document decides when boot happens — set that before the import, and let no test's globals leak into the next. Do not rebuild the bundle here; freshness is scripts/build.test.ts's rule and this test would then prove nothing about what is committed. src/client/main.ts is rewritten by #5 and by pull #7, so keep the assertions to observable behaviour rather than internals.

Suggested: Vesper — the same shape they built for the range.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs