tests-reports-manager
v0.2.0
Published
Archive and compare test reports across runs (Playwright-first). Never lose yesterday's report again.
Maintainers
Readme
tests-reports-manager (trm)
Archive every test run instead of overwriting playwright-report/. Compare today's run to yesterday's. Browse runs in a local web UI.
Playwright-first, but works with any test runner (the playwright report just won't be parsed).
Install
npm install -D tests-reports-managerThen in your project:
npx trm initThis creates .trmrc.json, ensures .test-reports/ exists, and adds it to .gitignore.
Quickstart
Wrap your usual test command:
npx trm run -- npx playwright testEach call archives a new run under .test-reports/runs/<timestamp>__<sha>/ with:
manifest.json(metadata, summary, git info)playwright-report/(the full HTML report, untouched)results.json(Playwright JSON reporter output)tests.json(parsed test list)stdout.log/stderr.log(full output)
Commands
| Command | What it does |
|---|---|
| trm init | Create .trmrc.json, init storage, update .gitignore |
| trm run -- <cmd> | Run <cmd> and archive the resulting Playwright report |
| trm list | Table of archived runs (newest first) |
| trm diff [refA] [refB] | Compare two runs. Refs: latest, previous, run id, or short prefix. Defaults to previous latest |
| trm serve [--port N] [--no-open] | Local web UI on 127.0.0.1:4789 |
| trm open [ref] | Open the HTML report of a run in the default browser |
| trm clean [--keep N] [ids...] | Apply retention or delete specific runs |
Web UI
npx trm serve/lists every archived run with a one-click "Open report" link.- The dropdown lets you pick two runs and click
Diffto jump to the comparison view. Diffview shows counts ofregressed,fixed,added,removed,flaky-changed, plus the list of tests whose status changed./tests.htmllists every unique test seen across all runs, with its failure rate and ticket status. Filter by ticket status or "currently failing only"./test.html?key=<test-key>shows one test: a timeline of pass/fail across runs and a form to attach a ticket (status, owner, linked URL, note) with full status history.
Per-test tickets
When a test fails, you usually want to document why and track its evolution. From /tests.html, click any test to land on its detail page and fill the ticket form. Status enum:
untriaged(default for new failures)investigatingknown-issueflaky-envbug-confirmedfixedwont-fix
Tickets are stored server-side in .test-reports/tickets.json (versioned with your other artifacts if you choose). They are visible to anyone hitting the trm serve URL, so the same data can be shared in CI by exposing the server.
Tickets are keyed by <file>::<spec title>. If you rename a test, its ticket points to the old key until you reattach it.
REST API:
GET /api/tests # aggregated list
GET /api/tests/history?key=<encoded> # timeline of one test
GET /api/tickets # all tickets
GET /api/tickets/by-key?key=<encoded> # one ticket
PUT /api/tickets # body: { testKey, status, severity?, owner?, linkedTicketUrl?, note? }
DELETE /api/tickets?key=<encoded> # remove a ticketConfiguration (.trmrc.json)
All fields optional:
{
"storageDir": ".test-reports",
"retention": { "keep": 30 },
"playwright": {
"reportDir": "playwright-report",
"jsonReport": "results.json"
},
"server": { "port": 4789 }
}retention.keep triggers automatic cleanup after each trm run. Set to 0 to disable.
How it works under the hood
trm run injects two env vars before spawning the test command:
PLAYWRIGHT_HTML_REPORT=.test-reports/runs/<id>/playwright-reportPLAYWRIGHT_JSON_OUTPUT_NAME=.test-reports/runs/<id>/results.json
So Playwright writes directly into the run folder. If your config writes to a fixed path instead, trm falls back to copying from playwright.reportDir after the run finishes.
stdout and stderr are tee'd to the terminal AND captured to log files - you see your tests run in real time, no buffering, exit code is preserved.
Programmatic API
import { runWrap, runList, runDiff, buildApp } from "tests-reports-manager";
await runWrap({ argv: ["npx", "playwright", "test"] });
const runs = runList();
const diff = runDiff({ refA: "previous", refB: "latest" });Requirements
- Node.js >= 18
License
MIT
