overview
यह क्या करती है
यह स्किल Ginkgo टूल के काम करने के तरीके की साफ़ तस्वीर देती है। यह उन डेवलपर्स के लिए है जो Ginkgo टेस्ट प्रोजेक्ट शुरू कर रहे हैं या किसी टेस्टिंग काम की योजना बना रहे हैं।
कब इस्तेमाल करें
- ✓जब आप पहली बार Go प्रोजेक्ट में Ginkgo टेस्ट पर काम शुरू करते हैं।
- ✓जब Ginkgo प्रोजेक्ट में किसी टेस्टिंग काम को करने का तरीका तय करना हो।
- ✓जब आपके Ginkgo टेस्ट उम्मीद से अलग व्यवहार करें।
Skill का लिंक
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं Go के लिए Ginkgo में नया हूं, शुरू करने से पहले क्या आप समझा सकते हैं कि इसके टेस्ट कैसे व्यवस्थित होते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह समझाती है कि Ginkgo पहले सभी टेस्ट की सूची बनाता है और फिर उन्हें चलाता है, और खास विषयों के लिए दूसरी गाइड्स की ओर इशारा करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Ginkgo: the mental model
Ginkgo is an expressive BDD-style testing framework for Go, paired with the Gomega matcher library. You build suites out of nested container nodes (Describe/Context/When) and subject nodes (It), with setup nodes (BeforeEach/AfterEach/…) supplying state. You drive it with the ginkgo CLI. Strongly prefer ginkgo over go test.
Read the canonical narrative docs at https://onsi.github.io/ginkgo/ — they are the source of truth. This skill is the orientation; the other skills go deep.
The one idea: tree construction, then running
Ginkgo runs your suite in two distinct phases. Internalizing this explains nearly every Ginkgo gotcha:
- Tree-construction phase. Ginkgo invokes every container body exactly once to discover the structure of your suite. It collects — but does not run — the closures you pass to setup and subject nodes. The result is a tree it flattens into a list of specs.
- Run phase. Ginkgo walks the flattened spec list (randomized, possibly in parallel) and, for each spec, runs its setup closures, then its one subject closure, then its cleanup closures.
Container bodies run at construction time. Setup/subject closures run later, at run time. The consequences you must internalize:
- No assertions in container bodies. They'd run once during construction, with no spec active — not as part of any test. Put assertions in
ItorBeforeEach. - No initialization in container bodies. A variable set in a
Describebody is set once, shared across every spec, and mutated by whichever spec runs first. Declare in the container, initialize inBeforeEachso every spec gets a pristine copy. →ginkgo:writing-specs. - Loops that build specs run at construction time — that's how you generate specs dynamically, but it also means closure-captured loop variables and any data the loop reads must be available then, not in
BeforeSuite. →ginkgo:tables-and-dynamic-specs.
Spec independence — the assumption everything rests on
Ginkgo assumes every spec is independent. This is what lets it randomize order (--randomize-all), run specs in parallel across processes (-p), and run any subset (--focus/labels). The rule that keeps you honest: declare in container, initialize in setup. Deliberate cross-spec dependencies break randomization and parallelism — when you genuinely need ordering, say so explicitly with an Ordered container (→ ginkgo:ordering-and-flakes) rather than relying on definition order.
The Parallelism Model
Ginkgo's parallelism model is process-based: each process runs a subset of the specs, with no shared memory.
The node taxonomy at a glance
- Containers —
Describe,Context,When(identical; pick the one that reads best). Organize the tree. - Subjects —
It,Specify(identical). The actual test; contains the assertions. - Setup —
BeforeEach/AfterEach(around every spec),JustBeforeEach/JustAfterEach(split configuration from creation),BeforeAll/AfterAll(once perOrderedcontainer),BeforeSuite/AfterSuite(once per suite),SynchronizedBeforeSuite/SynchronizedAfterSuite(for common setup, then per-process setup when parallel).DeferCleanupregisters teardown inline;DeferOnFailureregisters failure-only diagnostics that run before teardown. - Reporting —
ReportAfterEach/ReportAfterSuiteetc. observe results. →ginkgo:reporting. - Decorators — modifiers attached to any node:
Serial,Ordered,Label,Focus,FlakeAttempts,SpecTimeout, … →ginkgo:decorators.
Failures work by panic: Fail (which Gomega calls for you) panics; Ginkgo recovers it, records the failure, and runs cleanup. A goroutine that might fail needs defer GinkgoRecover() or its panic crashes the suite. → ginkgo:timeouts-and-async.
Where to go next
- Wiring Ginkgo into a project (bootstrap,
RunSpecs, the CLI, dot-import alternatives) →ginkgo:setup - Authoring specs (containers, subjects, setup/cleanup, the construction-time pitfalls) →
ginkgo:writing-specs - Table-driven and generated specs (
DescribeTable, shared behaviors) →ginkgo:tables-and-dynamic-specs - Looking up a decorator →
ginkgo:decorators - Running a subset (focus, skip, labels) →
ginkgo:filtering - Running in parallel / integration suites →
ginkgo:parallelism - **Ordered containers and fl
अक्सर पूछे जाने वाले सवाल
Ginkgo क्या है?
Ginkgo, Go प्रोग्रामिंग भाषा के लिए एक टेस्टिंग फ़्रेमवर्क है, जो पढ़ने में आसान, वाक्य जैसी शैली इस्तेमाल करता है।
क्या यह स्किल मेरे लिए टेस्ट लिखती है?
यह टेस्ट लिखने में मार्गदर्शन के लिए ज़रूरी पृष्ठभूमि देती है, और उसी सेट की दूसरी गाइड्स विवरण कवर करती हैं।
क्या मुझे ginkgo कमांड इस्तेमाल करना चाहिए?
स्किल standard go test कमांड की जगह ginkgo command-line टूल की सलाह देती है।
जानकारी
लेखक का मूल विवरण
The Ginkgo mental model for writing Go tests — the one idea that explains everything (Ginkgo builds a spec tree at construction time, then runs it) and its consequences for how you write specs, plus spec independence and the node taxonomy. Use this first when you start working with Ginkgo in a project, or to decide how to approach a Ginkgo task. Routes to the other ginkgo:* skills.
repo: onsi/ginkgo
लोकप्रियता
- GitHub स्टार
- 9.1k
- रैंकिंग में स्थान
- #12303
- लाइसेंस
- MIT
- अपडेट की गई
- 9/10/2026
कमेंट
- …
इस repository की और skills
ci
9.1kयह आपके एजेंट को Ginkgo टेस्ट CI के लिए सेट करने में मदद करती है, ताकि बचे हुए focus या pending निशान और flaky टेस्ट पकड़े जा सकें।
debugging-failures
9.1kयह आपके एजेंट को summary लाइन पढ़कर और JSON रिपोर्ट से ठीक फ़ेल होने वाले टेस्ट और संदेश निकालकर Ginkgo टेस्ट फ़ेल होने का कारण ढूंढने में मदद करती है।
decorators
9.1kयह आपके एजेंट को Ginkgo टेस्ट decorators सही ढंग से इस्तेमाल करने में मदद करती है, जैसे Serial, Ordered, Label, Focus और timeouts, हर एक का काम समझाकर।
filtering
9.1kयह आपके एजेंट को Ginkgo के कुछ ही टेस्ट चलाने में मदद करती है, pending, skip, focus, labels और file filters को सही क्रम में लगाकर।
मिलती-जुलती skills
test-driven-development
311kयह आपके एजेंट को किसी भी फ़ीचर या सुधार से पहले पहले असफल होने वाला टेस्ट लिखना, उसे असफल होते देखना, फिर पास करने वाला सबसे छोटा कोड लिखना सिखाती है।
verification-before-completion
311kयह आपके एजेंट को किसी काम, सुधार या build के पूरा या पास होने का दावा करने से पहले असली जांच चलाकर उसका आउटपुट पढ़ना सिखाती है।
migrate-to-shoehorn
310kआपकी टेस्ट फ़ाइलों में जोखिम भरे type casts की जगह shoehorn लाइब्रेरी लगाती है, ताकि टेस्ट अधूरे डेटा से भी type checks पास कर सकें।