reporting
Fungsinya
Skill ini menjelaskan cara mengendalikan tampilan hasil tes Ginkgo dan cara menyimpannya sebagai laporan yang bisa dibaca mesin. Skill ini ditujukan untuk pengembang yang menginginkan keluaran tes yang jelas atau laporan untuk alat lain.
Kapan dipakai
- βSaat Anda ingin lebih banyak atau lebih sedikit detail pada hasil tes yang tampil di layar.
- βSaat Anda membutuhkan file laporan JSON atau JUnit dari tes Ginkgo.
- βSaat Anda ingin memeriksa cakupan kode atau performa tes Go.
Link skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/reporting/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
βBisakah Anda membuat tes Go saya menyimpan laporan JUnit supaya sistem CI kami bisa membacanya?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menunjukkan opsi perintah yang mencetak keluaran rinci, menulis file laporan, dan mengukur cakupan atau kecepatan.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Reporting and profiling
How to produce reports and feed data into them. To read a failing report as an agent (the jq failure-diagnosis workflow), see ginkgo:debugging-failures. Docs: https://onsi.github.io/ginkgo/#generating-machine-readable-reports and https://onsi.github.io/ginkgo/#attaching-data-to-reports.
Console output
| Flag | Effect |
|---|---|
--succinct |
Minimal (default when running multiple suites). |
| (none) | Normal β detail only for failed specs (default, single suite). |
-v |
Full timeline for every spec; streams live in series. |
-vv |
-v plus node > Enter/< Exit events and every failure (not just the primary). |
--trace |
Full stack trace on every failure, not just panics. |
--no-color / GINKGO_NO_COLOR=TRUE |
Disable color. |
--github-output |
Format console output for GitHub Actions. |
In parallel (-p), -v/-vv timelines can't stream β the streams would interleave, so Ginkgo emits each spec's full timeline after that spec completes. β CI flags in ginkgo:ci.
Machine-readable reports
ginkgo -r --json-report=report.json --output-dir=./.reports
--json-reportis native and richest β an array oftypes.Report, each withSpecReports[]oftypes.SpecReport(godoc); build tooling against thetypespackage.--junit-report=x.xml,--teamcity-report=x,--gojson-report=x.go.jsonexist for external CI but lose Ginkgo metadata β use them to feed a system, not to diagnose. (JUnit maps aLabel("owner:XYZ")to theOwnerattribute.)--output-dir=DIRcollects all files in one place; under-rall suites merge into one report file.--keep-separate-reportswrites onePACKAGE_report.jsonper package instead.- Every machine-readable report embeds the full
-vvtimeline regardless of console verbosity. Run the suite quiet and mine the file β you don't need-vvon the console to get rich detail in the report.
Programmatic reporting nodes
CurrentSpecReport() works in any run-phase closure β use it for in-spec conditional diagnostics:
AfterEach(func() {
if CurrentSpecReport().Failed() {
GinkgoWriter.Println(libraryClient.DebugLogs()) // expensive diagnostics, only on failure
}
})
For custom report files, don't roll your own in AfterEach β use reporting nodes:
ReportAfterEach(func(r SpecReport){...})/ReportBeforeEachβ run for every spec including skipped/pending (unlikeAfterEach), after allAfterEaches. A failure here fails the spec. In parallel they run on each process concurrently β never write a shared file from them (you'll get interleaved garbage).ReportBeforeSuite/ReportAfterSuite("name", func(r Report){...})β top-level, and run only on process #1.ReportAfterSuitereceives theReportaggregated across all parallel processes β this is the safe place for custom suite-level report files:
ReportAfterSuite("custom report", func(report Report) {
f, _ := os.Create("report.custom")
for _, sr := range report.SpecReports {
fmt.Fprintf(f, "%s | %s\n", sr.FullText(), sr.State)
}
f.Close()
})
Reporting nodes can be made interruptible by also accepting SpecContext β ginkgo:timeouts-and-async.
Attaching data to a spec: AddReportEntry
It("is reported", func() {
AddReportEntry("Publish stats", stats, ReportEntryVisibilityFailureOrVerbose)
})
AddReportEntry(name, value, ...args) attaches arbitrary data to the current spec; it lands in SpecReport.ReportEntries, in all machine-readable reports, and (per visibility) on the console. Visibility enum:
ReportEntryVisibilityAlways(default) β always printed.ReportEntryVisibilityFailureOrVerboseβ only on failure or-v(likeGinkgoWriter).ReportEntryVisibilityNeverβ never on console, but still in the JSON report.
For failure-only diagnostics, call AddReportEntry from a DeferOnFailure callback (β ginkgo:writing-specs).
value is JSON-round-tripped into the report (retrieve via entry.GetRawValue() / json.Unmarshal(entry.Value.AsJSON, ...)). A fmt.Stringer/types.ColorableStringer controls console rendering; pass a pointer to capture later mutations. AddReportEntry decorators (Offset, CodeLocation, ReportEntryVisibility) β ginkgo:decorators.
Recap (owned by ginkgo:writing-specs): GinkgoWriter buffers log output a
Pertanyaan umum
Apa itu laporan JUnit?
Itu adalah format file standar yang bisa dibaca banyak sistem build dan tes untuk menampilkan hasil tes.
Bisakah saya melihat setiap tes saat berjalan?
Bisa. Opsi verbose menampilkan linimasa untuk setiap tes, meskipun pada proses paralel linimasa ditampilkan setelah tes itu selesai.
Apakah skill ini mengubah tes saya?
Skill terutama membahas opsi perintah dan kode pelaporan, jadi tes Anda tetap sama kecuali Anda menambahkan langkah pelaporan.
Detail
Deskripsi asli dari pembuat
Generate, consume, and enrich Ginkgo reports β console verbosity (-v/-vv/--trace/--no-color/--succinct), machine-readable reports (--json-report/--junit-report with --output-dir/--keep-separate-reports), programmatic reporting nodes (ReportAfterEach, ReportAfterSuite, CurrentSpecReport), AddReportEntry with ReportEntryVisibility, and profiling (--cover/--race/--cpuprofile/--memprofile). Use when you need a report file, custom suite-level reporting, attaching data to a spec, controlling console output, or profiling a suite.
repo: onsi/ginkgo
Popularitas
- Bintang GitHub
- 9.1k
- Peringkat
- #12305
- 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.
debugging-failures
9.1kMembantu agent Anda mencari tahu mengapa tes Ginkgo gagal dengan membaca baris ringkasan dan mengambil tes yang gagal beserta pesannya dari laporan JSON.
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.
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.