CodeceptJS 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 (run codeceptjs-fundamentals if unknown). Without it there are only screenshots and pageInfo dumps — suggest enabling and re-running before deep analysis.
run_step_by_step is interactive only; aiTrace is the sole source of per-step files. Ad-hoc run_code / snapshot still produce single-shot bundles under output/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 with jq, don't read every entry.
- Scanning many files:
grep -l for 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 —
diff the ARIA snapshots of that step between runs
console.json differs 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 specific waitFor*
- Resists static analysis →
debugging-codeceptjs-tests (live MCP loop)
- Clean pass → done, but glance at
console.json anyway
Things to avoid
- Reading large HTML or
console.json whole — 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 -p overrides
codeceptjs-exploration — locator drift fixes
debugging-codeceptjs-tests — live loop + offline locator resolution via codeceptq
1---2name: codeceptjs-run-analysis3description: Use after running CodeceptJS tests with the `aiTrace` plugin enabled and the results need review — verify a fix held, investigate a single failure, cluster errors across a CI fail-storm, diagnose flakiness across reruns. Invoked by other CodeceptJS skills whenever a run has happened. Trigger on "what failed", "analyse the run", "cluster these errors", "is it flaky", "did the fix hold".4---56# CodeceptJS Run Analysis78After `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.910No single end goal: pick the use case matching the situation. The foundations apply to all of them.1112## Foundations1314- **aiTrace must be on.** Everything leans on `output/trace_<TestName>_<hash>/trace.md`. Confirm in the active config (run `codeceptjs-fundamentals` if unknown). Without it there are only screenshots and `pageInfo` dumps — suggest enabling and re-running before deep analysis.15- `run_step_by_step` is interactive only; `aiTrace` is the sole source of per-step files. Ad-hoc `run_code` / `snapshot` still produce single-shot bundles under `output/trace_run_code_*` / `output/snapshot_*`.16- **Locate traces**: reruns create new dirs — when unclear, most recent wins (`ls -dt output/trace_*`).17- **Read trace.md first** — it's the index linking each step to its artifacts.18 - Focus on the failed step; none marked → last step in the trace.19 - Multiple failures marked → the **first** is usually the cause; the rest cascade.2021### Artifact order for the focus step (`NNNN_<step>`)2223| Artifact | When |24|---|---|25| `NNNN_*_aria.txt` | First read — lean, structured, easy to scan for duplicates |26| `NNNN_*_screenshot.png` | Visual confirmation — layout, animation, "rendered but wrong" |27| `NNNN_*_console.json` | JS errors, 4xx/5xx, deprecation warnings explaining vanished elements |28| `NNNN_*_storage.json` | Cookies + localStorage at this step — first stop when auth suspected |29| `NNNN_*_page.html` | Last resort, and only via `grep` |3031### Never read big files whole3233- HTML snapshots: search with `grep` (text, class, aria-label, `data-*`) — line numbers + context flags keep matches readable.34- `console.json`: filter with `jq`, don't read every entry.35- Scanning many files: `grep -l` for filenames only.3637## Use cases3839### Verify a fix held40Locate latest trace → read trace.md → confirm no FAILED markers. Glance at `console.json` for warnings worth fixing while you're there.4142### Cluster errors across a CI batch43Extract failing-step lines from every `trace.md`, group by signature (`grep` + `sort` + `uniq -c`), rank by frequency.44- Same error in many tests = **systemic** (env var, auth, base URL, deploy regression) — fix root cause once, rerun the batch.45- Different errors per test = local — triage one at a time.46Start with the most frequent root cause; rerun to see how many tests came back with it.4748### Diagnose flakiness49Rerun the same test 5–10 times; compare which step failed in each trace.50- Different step each run → timing, environment, external service51- Same step, different state → missing/wrong wait — `diff` the ARIA snapshots of that step between runs52- `console.json` differs between runs → transient backend/network errors53- Bounding box differs → layout reflow or late-loading content5455### Investigate a single failure56Failed-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`.5758## After analysis5960- Systemic cause → fix root once (env, auth, deploy), not per test61- Locator drift → `codeceptjs-exploration`62- Timing/wait issue → Waiting guidance from fundamentals/writing skills; replace `I.wait(N)` with specific `waitFor*`63- Resists static analysis → `debugging-codeceptjs-tests` (live MCP loop)64- Clean pass → done, but glance at `console.json` anyway6566## Things to avoid6768- Reading large HTML or `console.json` whole — `grep` / `jq`.69- Stopping at the last marked failure instead of the first.70- Triaging individual failures before clustering.71- Flakiness conclusions from a single run — needs 5+ reruns.72- Deleting `output/` mid-investigation.7374## Related skills7576- `codeceptjs-fundamentals` — what's configured, aiTrace `-p` overrides77- `codeceptjs-exploration` — locator drift fixes78- `debugging-codeceptjs-tests` — live loop + offline locator resolution via `codeceptq`