LLM-friendly test setup
This repo uses @vis.gl/dev-tools for shared Vitest wiring and keeps repository-specific Playwright utilities under scripts/playwright/ so agents and contributors can use a small set of stable top-level commands without needing to remember the underlying runner details.
How it is structured
- The root package exposes the user-facing commands:
yarn test-nodeyarn test-node-coverageyarn test-browseryarn test-browser-benchmarksyarn test-headlessyarn test-coverageyarn website-debugyarn playwright:install
- The test commands use
@vis.gl/dev-tools. - Repository-specific Vitest configuration lives in
vitest.config.ts. - Repository-specific Playwright utilities live under
scripts/playwright/. - Playwright aliases and defaults live in
.ocularrc.js.
Why this is LLM-friendly
- There is one stable command surface at the repo root.
- The reusable boilerplate is separated from luma-specific overrides.
- Agents can inspect
vitest.config.tsandscripts/playwright/to understand the Vitest and Playwright behavior. .ocularrc.jsshows which Playwright values are local repo extensions instead of reusable defaults.
Vitest behavior
vitest.config.tsdelegates togetVitestConfig()from@vis.gl/dev-tools.- The config creates three projects:
nodebrowserheadless
- Browser execution uses Playwright through
@vis.gl/dev-tools. - Node test files run in worker threads and reuse the worker's module graph. Tests that replace
globals or mutate module-level state must restore that state in an
afterEachorafterAllhook. nodeOnlyTestPatternsroutes audited CPU-only legacy specs away from browser-page isolation.- Browser test files remain isolated because GPU devices, presentation contexts, and queued GPU work are not safe to share between files.
- Browser coverage uses weighted sharding so known slow GPU specs are spread across the existing
three CI jobs. Benchmark-only specs run with
yarn test-browser-benchmarksinstead of adding instrumented browser pages to every pull request. - CI merges focused Istanbul coverage from CPU-only specs moved to Node and native Node coverage anchors with Istanbul coverage from the three browser shards. The complete Node suite still runs separately without instrumentation so coverage remapping does not slow the build job.
- The tape-style compatibility helper lives at
test/utils/vitest-tape.ts.
Playwright behavior
yarn website-debugruns the thin CLI wrapper inscripts/playwright/.- Example aliases and defaults come from
.ocularrc.js. - The runner can:
- open any website example by route or alias
- switch between
WebGPUandWebGL2 - collect console and page diagnostics
- launch a debug-enabled Chromium or attach over CDP
Practical guidance for agents
- Prefer the root scripts instead of calling workspace binaries directly.
- When changing shared test tooling, update
@vis.gl/dev-toolsand keep root scripts thin. - When changing repo-specific Vitest policy, update
vitest.config.ts. - When changing repo-specific Playwright policy, update
.ocularrc.jsorscripts/playwright/. - When explaining the test harness, point readers here and to:
docs/developer/dev-tools/playwright.mddocs/developer/dev-tools/browser-debug.mdvitest.config.ts.ocularrc.js