Scripts
Custom scripts in ./scripts/ that extend the project's tooling.
test.mjs
Unified test runner for a single source file. Runs Vitest with coverage scoped to the source file, then optionally chains Stryker mutation testing or Playwright e2e tests.
Usage
bash
# Run unit tests with coverage for a source file
pnpm test "src/core/i18n/components/locale-switcher.tsx"
# Run unit tests + Stryker mutation testing
pnpm test "src/core/i18n/components/locale-switcher.tsx" -m
# Run Playwright e2e tests (accepts substring patterns)
pnpm test theme-toggle -eFlags
| Flag | Description |
|---|---|
--no-coverage | Skip coverage collection (vitest only) |
-m, --mutation | Run Stryker mutation testing after Vitest |
-e, --e2e | Run Playwright e2e tests instead of Vitest |
-m and -e are mutually exclusive.
How it works
- Parses the source file path and flags from args
- If
-e: passes the pattern to Playwright as a substring filter and exits - Verifies the source file exists on disk
- Derives spec file paths (
<name>.spec.tsor__tests__/<name>.spec.ts) - Runs Vitest on the spec files with
--coverage.includescoped to the source file - If
-m: runs Stryker with--mutateon the source file - If
-m: extracts survived mutants frommutation.jsoninto.temp/mutants.txt
check-a11y.mjs
Runs axe-core accessibility audits against one or more routes. Requires the dev server to be running.
Usage
bash
pnpm check:a11y / /about /login
pnpm check:a11y http://localhost:3000/loginHow it works
- Accepts paths (
/login) or full URLs (http://localhost:3000/login) - Prefixes paths with
http://localhost:3000 - Runs the
axeCLI with--exit(non-zero exit on violations) - Exits with code 1 if any accessibility issues are found