Documentation
¶
Overview ¶
Package axecov is the axe-coverage manifest shared between the axe test harness and strict mode. The harness (framework/testkit/axetest) calls Record after every successful scan, accumulating which URL paths the app's accessibility tests actually exercised; uihost strict mode reads the result with Read and refuses to serve a page route no axe test covers.
The manifest lives at .gofastr/axe-coverage.json under the canonical coverage root (DefaultDir: GOFASTR_AXE_COVERAGE_DIR, else the module root, else the working directory) so the writer (tests) and the readers (strict mode) agree even when their working directories differ. `.gofastr/` is a local build-artifact directory (gitignored, wiped by `make clean`), so the manifest never ships: strict mode only enforces axe coverage in dev, where the file exists.
This package is deliberately dependency-free (no chromedp) so production code can read manifests without linking a headless browser.
Index ¶
Constants ¶
const FileName = ".gofastr/axe-coverage.json"
FileName is the manifest location relative to the app/test working directory.
Variables ¶
This section is empty.
Functions ¶
func DefaultDir ¶
func DefaultDir() string
DefaultDir is the canonical coverage-root both the writer (the axe test harness) and the readers (uihost strict mode, tooling) resolve, so the manifest lands where enforcement looks for it even when the test package dir and the server working directory differ (the `gofastr dev --dir <root> --pkg ./cmd/app` layout):
- GOFASTR_AXE_COVERAGE_DIR, when set — the explicit override.
- The nearest ancestor containing go.work — Go's own workspace rule. A test binary in a workspace's nested module (/repo/apps/shop) and a dev server at the workspace root (/repo) both find /repo/go.work, so they resolve the same directory.
- Else the nearest ancestor containing go.mod (the module root).
- Else the working directory itself.
Known limitation: several apps sharing one module (or workspace) share one manifest, and coverage is keyed by route path — two strict apps with the same route ("/", "/login") can satisfy each other's check. Set GOFASTR_AXE_COVERAGE_DIR per app (both when running its tests and its server) when that matters; single-app modules — every generated app — are unaffected.