playwright-ast-coverage
Static Playwright AST coverage for Next.js App Router projects.
playwright-ast-coverage helps teams and coding agents see which routes and
test-hook selectors are not exercised by Playwright tests. It scans source code
statically, so it is fast enough for local checks, CI guardrails, and agent
handoffs.
It is a heuristic coverage tool for Playwright/App Router workflows, not a replacement for runtime code coverage.
Install
The npm package installs a small JavaScript wrapper and downloads the matching native binary from GitHub Releases. Unsupported platforms can install from Cargo:
Why Use It
- Find App Router pages that no Playwright test visits.
- Find
data-testidanddata-pwhooks that tests never assert. - Ask for related tests when a page or component changes.
- Give AI agents a deterministic pre-finish coverage check.
Configure
Create .playwright-ast-coverage.yaml, .playwright-ast-coverage.yml,
.playwright-ast-coverage.json, or .playwright-ast-coverage.jsonc when your
app is not under the default app directory or when selectors live in shared
component folders:
frontendRoot: web/app
playwrightConfig: playwright.config.ts
selectorRoots:
- web/app
- web/components
selectorExclude:
- "**/*.test.tsx"
- "**/*.stories.tsx"