overview
/overview
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.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 2
No signals detected. Repository changed on 09.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
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.
Original author description
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.
How it works
- The one idea: tree construction, then running
- Spec independence — the assumption everything rests on
- The Parallelism Model
- The node taxonomy at a glance
- Where to go next
SKILL.md preview
--- name: overview description: 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. --- # Ginkgo: the mental model Ginkgo is an expressive BDD-style testing framework for Go, paired with the [Gomega](https://onsi.github.io/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: 1. **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. 2. **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 `It` or `BeforeEach`. - **No initialization in container bodies.** A variable set in a `Describe` body is set *once*, shared across every spec, and mutated by whichever spec runs first. **Declare in the container, initialize in `BeforeEach`** so 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 per `Ordered` container), `BeforeSuite`/`AfterSuite` (once per suite), `SynchronizedBeforeSuite`/`SynchronizedAfterSuite` (for common setup, then per-process setup when parallel). `DeferCleanup` registers teardown inline. - **Reporting** — `ReportAfterEach`/`ReportAfterSuite` etc. 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 flaky-spec management** → `ginkgo:ordering-and-flakes` - **Timeouts, interruptible nodes, and async assertions** → `ginkgo:timeouts-and-async` - **The CLI, randomization, and running multiple suites** → `ginkgo:running` - **A recommended CI configuration** → `ginkgo:ci` - **Reports, profiling, and attaching data** → `ginkgo:reporting` - **A suite failed and you want to know why** → `ginkgo:debugging-failures`
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · onsi/ginkgo | 90 | MIT |
| A7-studio/jobmigo | 100 | MIT |
| 8beeeaaat/touchdesigner-mcp | 100 | MIT |
| onsi/gomega | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
Database snapshot: 13.11.2026 · package version fa82125d8a4d (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100setup
Wire Ginkgo into a Go package — install the ginkgo CLI and Ginkgo+Gomega, ginkgo bootstrap to generate the suite_test.go (TestXxx/RegisterFailHandler(Fail)/RunSpecs), the package xxx_test convention, dot-import alternatives (aliased import, dsl/* subpackages, --nodot), ginkgo… - 100running
Run Ginkgo suites with the ginkgo CLI — run, -r, -p, --dry-run, watch, build (precompiled .test binaries), generate, outline, unfocus, labels, version; spec randomization (--randomize-all/--randomize-suites/--seed); running multiple suites… - 100biloba-testing
How to write and run Biloba's own Ginkgo test suite. Use when adding or modifying specs in this repo, asserting that a Biloba call should fail the test, working with the fixture server, or running the suite (including the driver, parity, e2e, and npm packaging lanes). Covers the… - 100explore-unfamiliar-page
Orient to an unfamiliar page, then draft a starter Go/Ginkgo Biloba spec from its DOM outline, accessibility tree, and screenshot. Use when writing browser tests against a URL or fixture you have not seen. Covers the orient-author-cleanup loop and accepts a URL or fixture… - 85ginkgo-cloud-lab
Submit and manage protocols on Ginkgo Bioworks Cloud Lab (cloud.ginkgo.bio), a web-based interface for autonomous lab execution on Reconfigurable Automation Carts (RACs). Use when the user wants to run cell-free protein expression (validation or optimization), generate… - 100cluster-logging
Use this skill to analyze failing CI tests for the OpenShift Cluster Logging Operator (ClusterLogForwarder, collector, LogFileMetricExporter), rerun the specific failing tests (Ginkgo/openshift-tests-extension, junit_openshift_logging_e2e_tests_cluster_logging_operator prefix),…