Skip to content
Skillpedia
Testing9.1k Β· #12299

debugging-failures

What it does

This skill shows how to find out why Go Ginkgo tests fail, without reading through long logs. It is for developers and agents who need clear failure details quickly.

When to use it

  • βœ“When a Ginkgo test suite fails and you need to know which test failed and why.
  • βœ“When test output is mixed up because tests ran in parallel.
  • βœ“When you want to rerun a failing test with the same random order.

Skill link

https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/debugging-failures/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/debugging-failures/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œMy Ginkgo tests failed. Find out exactly which tests failed and why.”

5 new skills a week. 1 minute to read.

How it works

The agent runs the suite once with a JSON report, reads the one-line result, and uses a filter to pull only the failing tests, their messages, file locations and captured logs. It can rerun with the same seed to reproduce the failure.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Debugging Ginkgo failures (especially as an agent)

Ginkgo's terminal output is good for a human; for programmatic diagnosis, prefer a hybrid: terminal for the verdict, JSON + jq for the details. This is empirically the most reliable, lowest-token workflow. Docs: https://onsi.github.io/ginkgo/#reporting-and-profiling-suites.

The workflow: one run, JSON-first diagnosis

# One invocation gives you BOTH the human verdict on the terminal AND a structured report.
# --json-report does NOT suppress console output, so you don't pay for two runs.
ginkgo -r -p --no-color --json-report=report.json --output-dir=.ginkgo-report
  1. Read the terminal tail for the one-line verdict: FAIL! -- 5 Passed | 6 Failed | 1 Pending | 1 Skipped. Cheap, immediate.
  2. If there are failures, query the JSON with jq (filters below) to get exactly the failing specs β€” stable, addressable, order-independent.
  3. Clean up the report dir when done.

Why hybrid and not one or the other:

  • Terminal-only is brittle to parse (free-form text) and, under -p, interleaves failures in nondeterministic order.
  • JSON-only is wasteful if you dump it: the full report.json is ~9Γ— the tokens of the terminal output. A jq failures-only extraction is a fraction of either. The discipline is filter, don't dump.

Where the JSON lands (use --output-dir deliberately)

  • --json-report=report.json alone writes report.json to the current directory β€” which scatters into package dirs under -r and risks getting committed.
  • Prefer --output-dir=DIR to collect everything in one known place (auto-created). With -r, all suites merge into one DIR/report.json β€” ideal: one file, one set of jq filters.
  • Use a gitignored or temp location: a repo-local .ginkgo-report/ (add it to .gitignore) or an absolute temp path (--output-dir=/tmp/ginkgo-report). Don't leave report.json in the working tree.
  • --keep-separate-reports (with -r) writes one PACKAGE_report.json per package instead of merging β€” only reach for it when you must attribute failures per package.

The jq filters (tested against the real schema)

The report is an array of suite reports, each with a .SpecReports[] array.

Verdict / counts per suite:

jq -r '.[] | "\(.SuiteDescription): \([.SpecReports[].State]|group_by(.)|map("\(length) \(.[0])")|join(", "))"' .ginkgo-report/report.json

All failures β€” name, location, message (the workhorse). Select failed and panicked and timedout β€” see the trap below:

jq -r '.[].SpecReports[]
  | select(.State=="failed" or .State=="panicked" or .State=="timedout")
  | "[\(.State|ascii_upcase)] \((.ContainerHierarchyTexts+[.LeafNodeText])|join(" > "))\n  \(.Failure.Location.FileName):\(.Failure.Location.LineNumber)\n  \(.Failure.Message)"' .ginkgo-report/report.json

Panics β€” the real user-code line (the headline location lies; see below):

jq -r '.[].SpecReports[] | select(.State=="panicked")
  | "PANIC: \(.Failure.ForwardedPanic)\n\(.Failure.Location.FullStackTrace)"' .ginkgo-report/report.json

Drill into one spec by name, with its captured logs:

jq -r '.[].SpecReports[] | select(.LeafNodeText|test("SUBSTRING"))
  | "STATE: \(.State)\n\(.Failure.Message)\n--- GinkgoWriter ---\n\(.CapturedGinkgoWriterOutput // "(none)")"' .ginkgo-report/report.json

Slowest specs:

jq '.[0].SpecReports | map([(.ContainerHierarchyTexts+[.LeafNodeText])|join(" "), .RunTime/1e9]) | sort_by(.[1]) | reverse | .[0:10]' .ginkgo-report/report.json

Schema facts you need

  • State: passed | failed | panicked | pending | skipped | timedout | interrupted | aborted.
  • Spec name = ContainerHierarchyTexts (array) + LeafNodeText.
  • Failure.Message β€” the failure text (Gomega's full expected/got block for assertions).
  • Failure.Location.{FileName,LineNumber,FullStackTrace}.
  • Failure.ForwardedPanic β€” the panic value (only meaningful for panicked).
  • Failure.FailureNodeType β€” e.g. BeforeEach vs It, so you know a setup node failed.
  • CapturedGinkgoWriterOutput β€” GinkgoWriter logs (omitted if empty).
  • SpecEvents[] β€” By(...) steps and node enter/exit (does not include raw GinkgoWriter text).
  • ParallelProcess β€” which worker ran the spec (-p).
  • AdditionalFailures[] β€” failures beyond the primary Failure (e.g. a failing AfterEach or DeferOnFailure callback). Usually the primary is
FAQ

Why not read the whole log?

Under parallel runs, failure messages can be mixed up, and the full report is much larger, so the skill filters for the details.

What is a seed?

It is the number that sets the random test order, and reusing it reproduces the same run.

Does it clean up the report files?

Yes. The skill ends by removing the report folder once the diagnosis is done.

Details

Original description by the author

Diagnose a failing Ginkgo suite as an agent β€” always run with --json-report into a predictable temp/gitignored location, read the terminal verdict line, then use jq to extract structured failure details (name, message, file:line, panic value, captured logs). Covers the panicked-vs-failed trap, panic locations pointing into the Go runtime, parallel output interleaving, reproducing with --seed, and progress reports for hangs. Use when a suite failed and you need to know why. Also invokable as /ginkgo:debugging-failures.

repo: onsi/ginkgo

Popularity

GitHub stars
9.1k
Ranking position
#12299
License
MIT
Updated
10/9/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills