Testing
Run the engine, web and Playwright suites, know what each covers, and add the right tests for a change without overloading your machine.
There are three test layers: vitest in packages/t2 for the engine and rules, vitest in apps/web for view models, parsing and PDFs, and Playwright in apps/web/e2e for the app in a real browser. CI runs all three on every push to main or dev and on pull requests.
Commands
pnpm --filter @workspace/t2 test # engine, scenarios, releases
pnpm --filter web test # web view models, PDF, parsing, docs
pnpm test:e2e # Playwright (reuses the dev server on :3000)
pnpm --filter web test:walk # the long filing-combination walk-through
pnpm typecheck && pnpm lintRun only one full suite at a time and keep vitest at --maxWorkers=2. Parallel full runs of vitest and tsc have exhausted memory on a laptop. While you work, run a single file: npx vitest run test/releases.test.ts --maxWorkers=2 from the package folder.
Both vitest configs set NEXT_PUBLIC_RULES_CHANNEL: "dev", so tests can select the draft 2026.1 release. The web config includes test/**/*.test.{ts,tsx} and maps @ to the app root.
Engine tests (packages/t2/test)
Release-sensitive tests use the approved fixture 2026.1a-test. Register your own fixture with registerTestRelease(r, { approvedBy }); its id must end in -test.
Web tests (apps/web/test)
These cover pure modules: store-persist.test.ts and store-seed.test.ts (persistence and the seed), return-status.test.ts, work-queue.test.ts, xlsx-import.test.ts, pdf.test.tsx (set PDF_OUT=<dir> to keep the files), compliance.test.ts, and docs.test.ts for the reference content. Keep logic out of components so it can be tested here.
Playwright (apps/web/e2e)
playwright.config.ts runs with two workers against one server. Locally it reuses the dev server on port 3000; in CI it serves the production build on port 3100. Projects:
Key specs: golden-path.spec.ts (the core journey; the filing step is skipped while 2026.1 is a draft), forms.spec.ts with form-cases.ts, at1.spec.ts, a11y.spec.ts (axe checks), layout-stability.spec.ts, overlays.spec.ts and reference-pages.spec.ts. Shared setup is in fixtures.ts. Failures keep a trace in e2e/.results.
What to add for a change
Before you call UI work done, take screenshots at phone and desktop widths in both themes and look at them.
Related
- ContributingBranch, change, check and open a pull request the way this repository expects, with the right extra steps for rules and UI changes.
- ConventionsFollow the house rules for Next 16 code, the design system, money and ids, user-facing text and finishing UI work.
- FormsWrite or change a form definition: fields, tables, applicability, checks, references, support level and form revisions.