decorators
Fungsinya
Skill ini adalah referensi untuk dekorator yang mengubah cara Ginkgo menjalankan atau memilih tes. Skill ini ditujukan untuk pengembang yang menulis tes Go dengan Ginkgo dan membutuhkan opsi yang tepat.
Kapan dipakai
- βSaat Anda ingin tes Ginkgo tertentu berjalan satu per satu atau dalam urutan tetap.
- βSaat Anda ingin memberi label pada tes agar Anda bisa menjalankan hanya sebagian.
- βSaat tes yang lambat membutuhkan batas waktu atau pengaturan ulang.
Link skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/decorators/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
βBuat tes Ginkgo ini berjalan sendiri, tidak paralel, dengan batas waktu 30 detik.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent memilih dekorator yang tepat untuk setiap node, misalnya Serial untuk tanpa paralel atau NodeTimeout untuk batas waktu, dan memeriksa jenis blok apa saja yang bisa diberi dekorator tersebut.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Ginkgo decorator reference
Terse lookup. Decorators are passed alongside a node's text/closure: It("...", Serial, Label("slow"), func(){...}). Most attach to containers and/or subjects; some are setup-only or interruptible-only. Decorators on a container apply to all nodes within it; the innermost/most-specific wins when they conflict. Full docs: https://onsi.github.io/ginkgo/#decorator-reference.
Execution / ordering
Serial(container, subject) β never runs in parallel; Ginkgo runs serial specs last, on process #1. βginkgo:parallelism.Ordered(container only) β child specs run in definition order, never reordered; enablesBeforeAll/AfterAll. βginkgo:ordering-and-flakes.ContinueOnFailure(outermostOrderedcontainer only) β a failing spec doesn't skip the rest of the ordered group.OncePerOrdered(setup nodes) β makes aBeforeEach/AfterEachrun once around anOrderedcontainer (like aBeforeAll) instead of per-spec.SpecPriority(int)(container, subject) β hint to run higher-priority specs earlier; use sparingly, not to impose a total order.
Selection / filtering (β ginkgo:filtering)
Label("a", "b")(container, subject) β tag specs for--label-filter; labels union down the hierarchy. No&|!,()/"chars.Focus(container, subject) β run only focused specs; don't commit it (CI exits non-zero). Constructors:FDescribe,FContext,FIt,FEntry.Pending(container, subject) β never run (and never compiled into the run set); no closure needed. Constructors:PDescribe,XDescribe,PIt,XIt,PEntry.SemVerConstraint(">= 2.0.0", ...)/ComponentSemVerConstraint("redis", ">= 8.0.0")(container, subject) β run only when--sem-ver-filtersatisfies the constraint; children may narrow, not widen.
Flakiness / repetition (β ginkgo:ordering-and-flakes)
FlakeAttempts(n)(container, subject) β retry a failing spec up tontimes; a later pass marks it flaky, not failed. CLI--flake-attempts=noverrides.MustPassRepeatedly(n)(container, subject) β the spec must passntimes in a row to count as passed.
Timeouts / interruption (interruptible nodes β those taking ctx SpecContext; β ginkgo:timeouts-and-async)
NodeTimeout(d)(subject, setup,DeferCleanup/DeferOnFailure) β deadline for a single interruptible node.SpecTimeout(d)(Itonly) β deadline for the whole spec (all its nodes combined).GracePeriod(d)(subject, setup,DeferCleanup/DeferOnFailure) β how long Ginkgo waits for an interrupted node to return before leaking it; overrides--grace-period.
Progress reporting (β ginkgo:debugging-failures)
PollProgressAfter(d)(subject, setup) β emit a progress report if the node runs longer thand;0disables.PollProgressInterval(d)(subject, setup) β interval between progress reports once they start.SuppressProgressReporting(subject, setup) β silence progress reports for this node.
Wrapping / advanced
AroundNode(fn)(any node, incl.RunSpecs) β wrap a node's execution; forms a stack on a container applied to every descendant node (unlikeBeforeEach, which runs once per spec). Forms: a barefunc(), a context transformerfunc(context.Context) context.Context, or a full wrapperfunc(ctx, func(context.Context)).
Location / identity (rarely needed by hand)
Offset(n)(any node) β skipnstack frames when computing the reported code location. PreferGinkgoHelper()inside helper funcs instead.CodeLocation(loc)(any node) β supply atypes.CodeLocationexplicitly.
Tables
EntryDescription("format %d")β auto-formatEntrydescriptions from their parameters; usable table-wide or per-entry. βginkgo:tables-and-dynamic-specs.Entry/Italso acceptLabel,Focus,Pending,FlakeAttempts, etc. β every decorator above works on table entries.
Reporting
ReportEntryVisibility{Always,FailureOrVerbose,Never}β passed toAddReportEntryto control console emission. βginkgo:reporting.
Pertanyaan umum
Apakah dekorator bisa berlaku untuk seluruh grup tes?
Sebagian bisa. Skill mencatat dekorator mana yang berlaku untuk grup dan mana yang hanya untuk tes tunggal.
Apa yang terjadi jika dua dekorator bertentangan?
Dekorator yang paling spesifik, yang paling dekat dengan tes, yang diutamakan.
Apakah Focus boleh di-commit?
Tidak. Skill menegaskan untuk tidak meng-commit Focus, karena CI akan gagal jika masih tertinggal.
Detail
Deskripsi asli dari pembuat
One-line reference for every Ginkgo decorator, grouped by what it does, with the node types each can decorate β Serial, Ordered, ContinueOnFailure, OncePerOrdered, Label, Focus, Pending, FlakeAttempts, MustPassRepeatedly, NodeTimeout, SpecTimeout, GracePeriod, PollProgressAfter/Interval, SuppressProgressReporting, SpecPriority, SemVerConstraint, AroundNode, Offset/CodeLocation, EntryDescription. Use to look up a decorator's exact name, semantics, and where it's legal.
repo: onsi/ginkgo
Popularitas
- Bintang GitHub
- 9.1k
- Peringkat
- #12300
- 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.
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.