debugging-failures
Fungsinya
Skill ini menunjukkan cara mencari tahu mengapa tes Go Ginkgo gagal, tanpa harus membaca log yang panjang. Skill ini ditujukan untuk pengembang dan agent yang butuh detail kegagalan dengan cepat.
Kapan dipakai
- βSaat rangkaian tes Ginkgo gagal dan Anda perlu tahu tes mana yang gagal dan mengapa.
- βSaat keluaran tes tercampur karena tes berjalan secara paralel.
- βSaat Anda ingin menjalankan ulang tes yang gagal dengan urutan acak yang sama.
Link skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/debugging-failures/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βTes Ginkgo saya gagal. Cari tahu persis tes mana yang gagal dan mengapa.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menjalankan rangkaian sekali dengan laporan JSON, membaca hasil satu baris, lalu memakai filter untuk mengambil hanya tes yang gagal, pesannya, lokasi file, dan log yang tersimpan. Agent bisa menjalankan ulang dengan seed yang sama untuk mereproduksi kegagalan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
- Read the terminal tail for the one-line verdict:
FAIL! -- 5 Passed | 6 Failed | 1 Pending | 1 Skipped. Cheap, immediate. - If there are failures, query the JSON with
jq(filters below) to get exactly the failing specs β stable, addressable, order-independent. - 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.jsonis ~9Γ the tokens of the terminal output. Ajqfailures-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.jsonalone writesreport.jsonto the current directory β which scatters into package dirs under-rand risks getting committed.- Prefer
--output-dir=DIRto collect everything in one known place (auto-created). With-r, all suites merge into oneDIR/report.jsonβ ideal: one file, one set ofjqfilters. - 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 leavereport.jsonin the working tree. --keep-separate-reports(with-r) writes onePACKAGE_report.jsonper 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 forpanicked).Failure.FailureNodeTypeβ e.g.BeforeEachvsIt, so you know a setup node failed.CapturedGinkgoWriterOutputβGinkgoWriterlogs (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 primaryFailure(e.g. a failingAfterEachorDeferOnFailurecallback). Usually the primary is
Pertanyaan umum
Mengapa tidak membaca seluruh log?
Pada proses paralel, pesan kegagalan bisa tercampur, dan laporan lengkap jauh lebih besar, jadi skill memfilter detailnya.
Apa itu seed?
Seed adalah angka yang menentukan urutan tes acak, dan memakainya kembali akan mereproduksi proses yang sama.
Apakah skill membersihkan file laporan?
Ya. Skill diakhiri dengan menghapus folder laporan setelah diagnosis selesai.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 9.1k
- Peringkat
- #12299
- Lisensi
- MIT
- Diperbarui
- 9/10/2026
Komentar
- β¦
Skill lain dari repositori ini
ci
9.1kMembantu agent Anda menyiapkan tes Ginkgo untuk integrasi berkelanjutan, dengan flag yang direkomendasikan untuk menangkap penanda fokus atau tertunda yang tertinggal serta tes yang tidak stabil.
decorators
9.1kMembantu agent Anda memakai dekorator tes Ginkgo dengan benar, seperti Serial, Ordered, Label, Focus, dan batas waktu, dengan menjelaskan fungsi masing-masing.
filtering
9.1kMembantu agent Anda menjalankan hanya sebagian tes Ginkgo, memakai pending, skip, focus, label, batasan versi, dan filter file sesuai urutan prioritasnya.
ordering-and-flakes
9.1kMembantu agent Anda mengendalikan urutan tes Go dan menangani tes yang tidak stabil, dengan pengaturan Serial dan Ordered dari Ginkgo serta opsi percobaan ulang.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.