Skip to content

Test pages headless

Checked against f15b998 on 2026-11-10. The files it covers are unchanged since.

niso-run runs a page exactly as a host would, without a window: the same DOM, style, layout and render stream, on virtual time. That makes it the quickest way to test a niso app, and it needs no simulator.

Terminal window
cargo build --release -p niso-quickjs --bin niso-run
(cd examples && pnpm install --frozen-lockfile && node build.mjs)
target/release/niso-run --dump --tap 60,140 examples/dist/counter.js
  • The DOM after some taps: --tap X,Y (repeatable) taps at CSS pixels after a frame, and --dump prints the document’s HTML at the end. Assert on it with grep or your test runner.
  • Layout: --boxes prints every element’s border box under body as JSON, so a test can check where things are.
  • What a host would draw: --render FILE writes every frame’s render stream.
  • Speed and memory: --time reports the time to first frame, the mean time per tap frame, the nodes alive after GC and peak memory.
  • What’s missing: --missing lists every DOM member and global the page looked up that niso doesn’t have.

Timers run on virtual time, so a page with a five-second timeout finishes in milliseconds; --max-ms bounds how much page time a run may take. A run exits 1 on any uncaught exception, which is enough for a smoke test in CI.

--serve URL=FILE answers a request with a file’s bytes, so a test that fetches always sees the same response. --storage DIR keeps localStorage and IndexedDB between runs, to test what a reload sees.

niso-node takes the same options and runs the page on Node, Deno or Bun (Headless), which helps tell an engine bug from a DOM bug.

Every option is in the CLI reference.