WorkDeveloper ToolsBuilding
Test Auditor
NPM CLI that orchestrates Jest test-quality audits, structured reports, and project-scoped report upload.
July 2026 – Present
Reusable developer tooling I built as an NPM package (`test-auditor`) so client repository audits stop being one-off manual reviews. Run `npx test-auditor --path .` (or `npm run audit` after init) against a Jest app or monorepo package: discover tests, run static AST analysis, execute Jest with coverage, score quality and completeness, optionally score CMS migration readiness, write Markdown and JSON reports, and stream the JSON report to a backend ingestion API.
- Problem
- Auditing client Jest suites was manual and inconsistent: coverage, flaky patterns, CMS migration gaps, and report handoff had to be rebuilt for every engagement.
- Solution
- Designed and shipped a reusable CLI workflow that standardizes discovery → static analysis → Jest/coverage → scoring → report generation → authenticated upload, with upward `.test-auditor.json` and `.env` discovery so teams configure once and run `npm run audit`.
Architecture notes
- CLI entry (`test-auditor`) orchestrates a multi-stage pipeline rather than a single script: config bootstrap, test discovery, optional CMS readiness, Babel static analysis, Jest + coverage, completeness scoring, Markdown/JSON report writers, then optional upload.
- Static checks cover Jest/RTL/Next.js hygiene categories such as focused/skipped tests, async flake patterns, snapshot overuse, weak assertions, unmocked network calls, and Next router/image mock gaps — without inventing browser SEO crawlers.
- Optional CMS readiness scans tests against a CMS pattern registry (AEM, Amplience, Contentful, CoreMedia, and others) for legacy fixtures/mocks vs target-CMS progress.
- DX: `test-auditor init` writes `.test-auditor.json`; config and `.env` resolve upward from cwd so monorepo packages can inherit root API settings while `--path` points at the Jest package root.
- Upload posts streamed JSON to `POST /api/reports` with `Content-Type: application/json` and `x-api-key`. Large reports (on the order of tens of MB) are streamed rather than held as a single in-memory string. The key identifies the project/client on the backend; the CLI never embeds server secrets.
- Local viewer opens a packaged report UI for interactive review after the audit completes.
Stack
- TypeScript
- Node.js
- NPM CLI
- Commander
- Babel AST
- Jest
- REST upload
Related
- Next.js App Router Migration Framework
Script-based tooling that migrates Pages Router apps onto App Router conventions.
- Performance Apparel CMS
Amplience content modeling, page workflows, and Next.js extensions for a high-traffic storefront.
