Langsung ke konten
Skillpedia
Testing9.1k Β· #12300

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.md

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/decorators/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

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; enables BeforeAll/AfterAll. β†’ ginkgo:ordering-and-flakes.
  • ContinueOnFailure (outermost Ordered container only) β€” a failing spec doesn't skip the rest of the ordered group.
  • OncePerOrdered (setup nodes) β€” makes a BeforeEach/AfterEach run once around an Ordered container (like a BeforeAll) 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-filter satisfies the constraint; children may narrow, not widen.

Flakiness / repetition (β†’ ginkgo:ordering-and-flakes)

  • FlakeAttempts(n) (container, subject) β€” retry a failing spec up to n times; a later pass marks it flaky, not failed. CLI --flake-attempts=n overrides.
  • MustPassRepeatedly(n) (container, subject) β€” the spec must pass n times 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) (It only) β€” 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 than d; 0 disables.
  • 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 (unlike BeforeEach, which runs once per spec). Forms: a bare func(), a context transformer func(context.Context) context.Context, or a full wrapper func(ctx, func(context.Context)).

Location / identity (rarely needed by hand)

  • Offset(n) (any node) β€” skip n stack frames when computing the reported code location. Prefer GinkgoHelper() inside helper funcs instead.
  • CodeLocation(loc) (any node) β€” supply a types.CodeLocation explicitly.

Tables

  • EntryDescription("format %d") β€” auto-format Entry descriptions from their parameters; usable table-wide or per-entry. β†’ ginkgo:tables-and-dynamic-specs.
  • Entry/It also accept Label, Focus, Pending, FlakeAttempts, etc. β€” every decorator above works on table entries.

Reporting

  • ReportEntryVisibility{Always,FailureOrVerbose,Never} β€” passed to AddReportEntry to 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

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa