filtering
Что он делает
Этот скилл объясняет множество способов запустить часть тестов Go на Ginkgo. Он нужен разработчикам, которые хотят запустить одну группу, пропустить другие или отметить тесты как ещё не готовые.
Когда использовать
- ✓Когда вы хотите запустить только одну часть большого набора тестов Ginkgo.
- ✓Когда тест ещё не готов и его нужно пока пропустить.
- ✓Когда вы хотите запустить тесты с определённой меткой, например slow или integration.
Ссылка на скилл
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/filtering/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Запусти только тесты Ginkgo с меткой integration и пропусти всё, что помечено как pending.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Агент выбирает между маркерами pending на этапе компиляции, пропусками во время запуска, focus, фильтрами по меткам и по именам, а затем объясняет, как они сочетаются, ведь одни опции перекрывают другие.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с 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
Частые вопросы
Можно ли заставить pending-тесты запуститься?
Нет. Ничто не отменяет маркер pending, поэтому тест остаётся пропущенным.
В чём разница между pending и skip?
Pending задаётся на этапе компиляции, а skip решается во время запуска.
Падает ли сборка из-за pending-тестов?
По умолчанию нет, но опция падения при pending делает CI неуспешным, если такие тесты есть.
Подробности
Оригинальное описание автора
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
Популярность
- Звёзды на GitHub
- 9.1k
- Место в рейтинге
- #12301
- Лицензия
- MIT
- Обновлён
- 09.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
ci
9.1kПомогает агенту настроить тесты Ginkgo для непрерывной интеграции с рекомендуемыми флагами, которые ловят оставленные метки focus и pending, а также нестабильные тесты.
debugging-failures
9.1kПомогает агенту понять, почему тесты Ginkgo упали: он читает строку с итогом и достаёт точные падающие тесты и сообщения из JSON-отчёта.
decorators
9.1kПомогает агенту правильно использовать декораторы тестов Ginkgo, например Serial, Ordered, Label, Focus и таймауты, объясняя, что делает каждый из них.
ordering-and-flakes
9.1kПомогает агенту управлять порядком тестов Go и обрабатывать нестабильные тесты с помощью настроек Serial и Ordered в Ginkgo и опций повтора.
Похожие скиллы
test-driven-development
311kУчит агента сначала писать падающий тест, увидеть, что он падает, и только затем писать минимальный код, который его проходит, прежде чем создавать любую функцию или исправление.
verification-before-completion
311kУчит агента запускать настоящие проверки и читать их вывод, прежде чем утверждать, что задача, исправление или сборка готовы или проходят.
migrate-to-shoehorn
310kЗаменяет рискованные приведения типов в тестовых файлах на библиотеку shoehorn, чтобы тесты могли использовать неполные данные и проходить проверку типов.