Testing and diagnostics
Check route behavior, project health, production rendering, and browser flows before a change reaches users.
Run the narrowest useful check
Use TypeScript and focused tests while editing, then widen the feedback loop as a change approaches release. Tavo.js diagnostics check the application shape and generated route contract without replacing tests for your product behavior.
Run in Terminal
bashnpx tsc --noEmit
npx tavo doctor
npx tavo check
npx tavo routesTest routes without a browser
createPagesTestHarness resolves an in-memory page map with the same route conventions used by the application. Use it for fast route, loader, middleware, and error-path tests; keep DOM interaction and hydration assertions in a real browser.
Create tests/pages/index.test.tsx
tsximport { createPagesTestHarness } from "@tavojs/core/dev";
import { Text } from "@tavojs/ui";
const app = createPagesTestHarness({
"/src/pages/index.tsx": {
default: () => <Text>Project dashboard</Text>,
},
});
export async function homePageResolves() {
const result = await app.runtime.resolvePathAsync("/");
if (
result.status !== 200 ||
result.pathname !== "/" ||
result.route?.path !== "/"
) {
throw new Error("Home page did not resolve successfully");
}
}
Test the production shape
A production build discovers routes, compiles client and server output, prerenders static pages, and reports JavaScript cost. SSR preview exercises the generated server entry rather than the development transform pipeline.
Exercise direct requests, client navigation, actions, 404 and error pages, and hydration in browser tests.
Start
npxtavopreview--ssrin a separate terminal for manual SSR checks, or configure it as Playwright'swebServer.Inspect
.tavo/generated/build-report.jsonwhen a route or shared first load grows unexpectedly.Add
--max-first-load-jsand--max-route-jslimits when CI should enforce bundle budgets.
Run in Terminal
bashnpx tavo build --report-json
npx playwright testKeep runtime evidence actionable
Development diagnostics identify route, mount, patch, and hydration phases. Start with the first server-client divergence and its DOM path; suppressing the warning leaves the underlying ownership or rendering mismatch in place.
Production logs and instrumentation should record route patterns, phases, timing, and stable diagnostic codes. Exclude request bodies, cookies, tokens, and loader results unless the application has an explicit redaction policy.