About codeceptjs-run-analysis
codeceptjs-run-analysis is a skill for diagnosing CodeceptJS test runs from their aiTrace artifacts. It helps test engineers investigate failures, flaky behavior, and CI-wide error patterns without rerunning analysis through MCP.
Key features
- 01Reads aiTrace step artifacts
- 02Prioritizes the first failed step
- 03Inspects ARIA, screenshots, console, and storage
- 04Searches large HTML snapshots selectively
- 05Clusters failures across CI traces
- 06Compares repeated runs for flakiness
Use cases
- 01Verify a fix against the latest trace
- 02Find common causes across CI failures
- 03Compare reruns to diagnose flaky tests
- 04Triage a single failed test step
MCP support
The skill analyzes existing trace files using bash tools rather than MCP. It suggests handing off to a live MCP debugging loop when static analysis is insufficient.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ codeceptjs/ skills --skill codeceptjs-run-analysisAfter installing, type/codeceptjs-run-analysisin Claude Code to confirm it loaded.
Details
From the project READMECodeceptJS Run Analysis
After npx codeceptjs run, trace artifacts land in output/. This skill reads them efficiently — right step, right file, right slice of a giant HTML snapshot — via bash tools rather than re-running through MCP.
No single end goal: pick the use case matching the situation. The foundations apply to all of them.
Foundations
- aiTrace must be on. Everything leans on
output/trace_<TestName>_<hash>/trace.md. Confirm in the active config (runcodeceptjs-fundamentalsif unknown). Without it there are only screenshots andpageInfodumps — suggest enabling and re-running before deep analysis. run_step_by_stepis interactive only;aiTraceis the sole source of per-step files. Ad-hocrun_code/snapshotstill produce single-shot bundles underoutput/trace_run_code_*/output/snapshot_*.- Locate traces: reruns create new dirs — when unclear, most recent wins (
ls -dt output/trace_*). - Read trace.md first — it's the index linking each step to its artifacts.
- Focus on the failed step; none marked → last step in the trace.
- Multiple failures marked → the first is usually the cause; the rest cascade.
Artifact order for the focus step (NNNN_<step>)
| Artifact | When |
|---|---|
NNNN_*_aria.txt | First read — lean, structured, easy to scan for duplicates |
NNNN_*_screenshot.png | Visual confirmation — layout, animation, "rendered but wrong" |
NNNN_*_console.json | JS errors, 4xx/5xx, deprecation warnings explaining vanished elements |
NNNN_*_storage.json | Cookies + localStorage at this step — first stop when auth suspected |
NNNN_*_page.html | Last resort, and only via grep |
Never read big files whole
- HTML snapshots: search with
grep(text, class, aria-label,data-*) — line numbers + context flags keep matches readable. console.json: filter withjq, don't read every entry.- Scanning many files:
grep -lfor filenames only.
Use cases
Verify a fix held
Locate latest trace → read trace.md → confirm no FAILED markers. Glance at console.json for warnings worth fixing while you're there.
Cluster errors across a CI batch
Extract failing-step lines from every trace.md, group by signature (grep + sort + uniq -c), rank by frequency.
- Same error in many tests = systemic (env var, auth, base URL, deploy regression) — fix root cause once, rerun the batch.
- Different errors per test = local — triage one at a time. Start with the most frequent root cause; rerun to see how many tests came back with it.
Diagnose flakiness
Rerun the same test 5–10 times; compare which step failed in each trace.
- Different step each run → timing, environment, external service
- Same step, different state → missing/wrong wait —
diffthe ARIA snapshots of that step between runs console.jsondiffers between runs → transient backend/network errors- Bounding box differs → layout reflow or late-loading content
Investigate a single failure
Failed-or-last step → ARIA + screenshot first, console second, HTML last (grep only). Form a hypothesis. Trace not enough / page needs live poking → hand off to debugging-codeceptjs-tests.
After analysis
- Systemic cause → fix root once (env, auth, deploy), not per test
- Locator drift →
codeceptjs-exploration - Timing/wait issue → Waiting guidance from fundamentals/writing skills; replace
I.wait(N)with specificwaitFor* - Resists static analysis →
debugging-codeceptjs-tests(live MCP loop) - Clean pass → done, but glance at
console.jsonanyway
Things to avoid
- Reading large HTML or
console.jsonwhole —grep/jq. - Stopping at the last marked failure instead of the first.
- Triaging individual failures before clustering.
- Flakiness conclusions from a single run — needs 5+ reruns.
- Deleting
output/mid-investigation.
Related skills
codeceptjs-fundamentals— what's configured, aiTrace-poverridescodeceptjs-exploration— locator drift fixesdebugging-codeceptjs-tests— live loop + offline locator resolution viacodeceptq