overview
Ce qu’il fait
Ce skill donne une vue d'ensemble du fonctionnement de l'outil de tests Ginkgo pour Go. Il s'adresse aux développeurs qui démarrent un projet de tests Ginkgo ou préparent une tâche de test.
Quand l’utiliser
- ✓Lorsque vous commencez pour la première fois à travailler avec des tests Ginkgo dans un projet Go.
- ✓Quand vous devez choisir comment aborder une tâche de test dans un projet Ginkgo.
- ✓Quand vos tests Ginkgo se comportent autrement que prévu.
Lien du skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/overview/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Je débute avec Ginkgo pour Go. Peux-tu m'expliquer comment ses tests sont organisés avant que l'on commence ?”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Le skill explique que Ginkgo construit d'abord la liste de tous les tests, puis les exécute, et renvoie vers d'autres guides pour les sujets précis.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis 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
Questions fréquentes
Qu'est-ce que Ginkgo ?
Ginkgo est un framework de tests pour le langage Go, qui utilise un style lisible proche de la phrase.
Ce skill écrit-il les tests à ma place ?
Il donne les bases nécessaires pour guider l'écriture des tests, et d'autres guides de la même série couvrent les détails.
Dois-je utiliser la commande ginkgo ?
Le skill recommande l'outil en ligne de commande ginkgo plutôt que la commande standard go test.
Détails
Description originale de l’auteur
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
Popularité
- Étoiles GitHub
- 9.1k
- Position au classement
- #12303
- Licence
- MIT
- Mis à jour
- 09/10/2026
Commentaires
- …
Autres skills de ce dépôt
ci
9.1kAide votre agent à configurer les tests Ginkgo pour l'intégration continue, avec des options qui détectent les marqueurs oubliés et les tests instables.
debugging-failures
9.1kAide votre agent à comprendre pourquoi des tests Ginkgo ont échoué, en lisant le résumé et en extrayant les tests et messages exacts d'un rapport JSON.
decorators
9.1kAide votre agent à utiliser correctement les décorateurs de tests Ginkgo, comme Serial, Ordered, Label, Focus et les délais, en expliquant le rôle de chacun.
filtering
9.1kAide votre agent à lancer une partie des tests Ginkgo avec pending, skip, focus, labels et filtres, dans le bon ordre de priorité.
Skills similaires
test-driven-development
311kApprend à votre agent à écrire d'abord un test qui échoue, à le voir échouer, puis à écrire le code minimal qui le fait réussir, avant de construire toute fonctionnalité ou correction.
verification-before-completion
311kApprend à votre agent à lancer de véritables contrôles et à lire leurs résultats avant d'affirmer qu'une tâche, une correction ou une compilation est terminée ou réussie.
migrate-to-shoehorn
310kRemplace les conversions de type risquées dans vos fichiers de test par la bibliothèque shoehorn, afin que les tests utilisent des données partielles et passent les contrôles de types.