filtering
What it does
This skill explains the many ways to run a subset of Go Ginkgo tests. It is for developers who want to run one group, skip others or mark tests as not ready.
When to use it
- βWhen you want to run only one part of a large Ginkgo test suite.
- βWhen a test is not ready and should be skipped for now.
- βWhen you want to run tests with a particular label, such as slow or integration.
Skill link
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/filtering/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βRun only the Ginkgo tests labeled integration, and skip anything marked pending.β
5 new skills a week. 1 minute to read.
How it works
The agent chooses between compile-time pending markers, runtime skips, focus, label filters and name filters, then explains how they combine, since some options override others.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Filtering specs: running a subset
Ginkgo offers many ways to run fewer specs β ad-hoc (Pending/Skip/Focus) and structured (labels, semver, file/description filters). They combine by a strict precedence (see bottom). Decorator specifics live in ginkgo:decorators; label-driven CI in ginkgo:ci. Docs: https://onsi.github.io/ginkgo/#filtering-specs.
Pending β compile-time skip, uncoercible
Marks a spec/container as under development. Nothing can override Pending and make it run β not focus, not labels.
It("needs work", Pending, func() { ... })
It("placeholder", Pending) // pending specs need no closure
PDescribe("not ready", func() { ... }) // == Describe(..., Pending); X-prefix is identical
PIt(...) / XIt(...) / PEntry(...)
Pending specs don't fail the suite. ginkgo --fail-on-pending makes them fail CI β a policy that pending specs shouldn't be committed. Pending is compile-time only; you cannot make a spec pending at runtime β for that, use Skip.
Skip β runtime skip
Call Skip("reason") from any subject or setup node to skip during the run phase. It panics to halt the spec (like Fail) and records the reason; it does not fail the suite (even skipping every spec passes).
It("if it can", func() {
if !someCondition { Skip("special condition wasn't met") }
...
})
Scope matters: in a BeforeEach it skips the current spec; in a BeforeAll it skips all specs in the Ordered container; in a BeforeSuite it skips the entire suite. You cannot call Skip in a container body β it only applies during the run phase.
Focus β programmatic, for iterating (don't commit it)
When any spec is focused, Ginkgo runs only focused specs.
FIt("just me", func() { ... }) // or It(..., Focus, ...)
FDescribe(...) / FContext(...) / FEntry(...)
Child focus unfocuses focused ancestors. F an inner It inside an FDescribe and only that It runs β matches how you narrow while debugging.
The danger: committing focus breaks CI quietly-loudly. A passing suite with programmatic focus exits non-zero (logs say it succeeded but flags focused specs) so CI catches it. Strip them all with ginkgo unfocus (removes F prefixes and Focus decorators).
Labels and --label-filter
Label("a", "b") (β ginkgo:decorators) tags container/subject nodes; a spec's labels are the union down its hierarchy. No &|!,()/" chars in a label. Filter with ginkgo --label-filter=QUERY:
| Operator | Meaning |
|---|---|
&& |
AND |
| ` | |
! |
NOT |
() |
grouping |
/regexp/ |
regex match against labels |
Bare words match label literals β case-insensitive, whitespace-trimmed.
ginkgo --label-filter="network && !slow"
ginkgo --label-filter="integration, smoke" # comma == ||
ginkgo --label-filter=/library/ # regex
Consistent labelling is a best-practice for maintainable filtering.
Label sets β KEY:VALUE
A label KEY:VALUE adds VALUE to set KEY (multiple values accumulate, e.g. Label("API:Library", "API:Geo") β API = {Library, Geo}). Filter with KEY: OP <arg> where arg is a single value or {V1, V2}:
| Op | Matches when set KEY⦠|
|---|---|
isEmpty |
has no KEY:* labels |
containsAny |
contains any arg element |
containsAll |
contains all arg elements |
consistsOf |
equals exactly the args |
isSubsetOf |
is a subset of args β note: an empty set always matches |
ginkgo --label-filter="integration && !slow && Readiness: isSubsetOf {Beta, RC}"
ginkgo --label-filter="API: consistsOf {Library, Geo}"
Set values are literals (no regex). Prefer sets over regexes for structured filtering.
- Suite-level labels:
RunSpecs(t, "Books Suite", Label("books"))apply to the whole suite β filter out entire suites. - Runtime check:
Label("perf").MatchesLabelFilter(GinkgoLabelFilter())lets a spec branch on the active--label-filter(GinkgoLabelFilter()returns it). - Discover/iterate:
ginkgo labelslists labels in a package;ginkgo --dry-run -v --label-filter=Qshows what a filter selects without running.
SemVer filtering
SemVerConstraint(">= 3.2.0") (and ComponentSemVerConstraint("redis", ">= 8.0.0")) gate specs by version; run with --sem-ver-filter. Constraints follow Masterminds/semver (~, ^, comma-ANDed). Hierarchical: child constraints *narrow
FAQ
Can pending tests be forced to run?
No. Nothing can override a pending marker, so the test stays skipped.
What is the difference between pending and skip?
Pending is set at compile time, while skip is decided during the run.
Do pending tests fail the build?
Not by default, but a fail-on-pending option makes CI fail if any are present.
Details
Original description by the author
Run a subset of a Ginkgo suite β Pending/PIt/XIt, runtime Skip, programmatic Focus/FIt (and ginkgo unfocus), Label with the --label-filter query language and label sets, suite-level labels, SemVerConstraint/--sem-ver-filter, --focus/--skip and --focus-file/--skip-file, the filtering precedence rules, and --fail-on-pending/--fail-on-empty. Use when you want to run, skip, focus, label, or version-gate specs, or debug why specs were or weren't selected.
repo: onsi/ginkgo
Popularity
- GitHub stars
- 9.1k
- Ranking position
- #12301
- License
- MIT
- Updated
- 10/9/2026
Comments
- β¦
More skills from this repository
ci
9.1kHelps your agent set up Ginkgo tests for continuous integration, with recommended flags that catch leftover focus or pending markers and flaky tests.
debugging-failures
9.1kHelps your agent find out why Ginkgo tests failed by reading the summary line and pulling the exact failing tests and messages from a JSON report.
decorators
9.1kHelps your agent use Ginkgo test decorators correctly, such as Serial, Ordered, Label, Focus and timeouts, by explaining what each one does.
ordering-and-flakes
9.1kHelps your agent control the order of Go tests and handle flaky ones, using Ginkgo's Serial and Ordered settings and retry options.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.