decorators
यह क्या करती है
यह स्किल एक संदर्भ गाइड है, जो बताती है कि Ginkgo टेस्ट कैसे चलते या चुने जाते हैं, इसे बदलने वाले decorators। यह Go में Ginkgo से टेस्ट लिखने वाले डेवलपर्स के लिए है।
कब इस्तेमाल करें
- ✓जब आप चाहते हों कि कुछ Ginkgo टेस्ट एक-एक करके या तय क्रम में चलें।
- ✓जब आप टेस्ट को labels से टैग करना चाहते हों, ताकि केवल कुछ टेस्ट चलें।
- ✓जब कोई धीमा टेस्ट timeout या retry सेटिंग मांगता हो।
Skill का लिंक
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/decorators/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस Ginkgo टेस्ट को अकेले चलाइए, parallel नहीं, और उसका timeout 30 सेकंड रखिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट हर node के लिए सही decorator चुनता है, जैसे parallel न चलाने के लिए Serial या समय सीमा के लिए NodeTimeout, और जांचता है कि कौन सा decorator किस तरह के block पर लग सकता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.
अक्सर पूछे जाने वाले सवाल
क्या decorators पूरे समूह पर लग सकते हैं?
कुछ लग सकते हैं। स्किल बताती है कि कौन से decorators समूह पर और कौन से अकेले टेस्ट पर काम करते हैं।
अगर दो decorators आपस में टकराएं तो क्या होगा?
सबसे विशिष्ट, यानी टेस्ट के सबसे करीब वाला, प्राथमिकता पाता है।
क्या Focus को कमिट करना चाहिए?
नहीं। स्किल कहती है कि Focus को कमिट न करें, क्योंकि वह रह जाए तो CI फ़ेल हो जाता है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 9.1k
- रैंकिंग में स्थान
- #12300
- लाइसेंस
- MIT
- अपडेट की गई
- 9/10/2026
कमेंट
- …
इस repository की और skills
ci
9.1kयह आपके एजेंट को Ginkgo टेस्ट CI के लिए सेट करने में मदद करती है, ताकि बचे हुए focus या pending निशान और flaky टेस्ट पकड़े जा सकें।
debugging-failures
9.1kयह आपके एजेंट को summary लाइन पढ़कर और JSON रिपोर्ट से ठीक फ़ेल होने वाले टेस्ट और संदेश निकालकर Ginkgo टेस्ट फ़ेल होने का कारण ढूंढने में मदद करती है।
filtering
9.1kयह आपके एजेंट को Ginkgo के कुछ ही टेस्ट चलाने में मदद करती है, pending, skip, focus, labels और file filters को सही क्रम में लगाकर।
ordering-and-flakes
9.1kयह आपके एजेंट को Go टेस्ट का क्रम नियंत्रित करने और flaky टेस्ट संभालने में मदद करती है, Ginkgo की Serial और Ordered सेटिंग्स और retry विकल्पों से।
मिलती-जुलती skills
test-driven-development
311kयह आपके एजेंट को किसी भी फ़ीचर या सुधार से पहले पहले असफल होने वाला टेस्ट लिखना, उसे असफल होते देखना, फिर पास करने वाला सबसे छोटा कोड लिखना सिखाती है।
verification-before-completion
311kयह आपके एजेंट को किसी काम, सुधार या build के पूरा या पास होने का दावा करने से पहले असली जांच चलाकर उसका आउटपुट पढ़ना सिखाती है।
migrate-to-shoehorn
310kआपकी टेस्ट फ़ाइलों में जोखिम भरे type casts की जगह shoehorn लाइब्रेरी लगाती है, ताकि टेस्ट अधूरे डेटा से भी type checks पास कर सकें।