본문으로 건너뛰기
Skillpedia
테스트9.1k · #12301

filtering

하는 일

이 스킬은 Go Ginkgo 테스트의 일부만 실행하는 여러 방법을 설명합니다. 한 묶음만 실행하고, 다른 것은 건너뛰고, 준비되지 않은 테스트를 표시하고 싶은 개발자를 위한 것입니다.

사용하는 경우

  • ✓큰 Ginkgo 테스트 묶음의 한 부분만 실행하고 싶을 때.
  • ✓준비되지 않은 테스트를 지금은 건너뛰어야 할 때.
  • ✓integration이나 slow 같은 특정 라벨의 테스트만 실행하고 싶을 때.

스킬 링크

https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/filtering/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/filtering/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“integration 라벨이 붙은 Ginkgo 테스트만 실행하고, 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 labels lists labels in a package; ginkgo --dry-run -v --label-filter=Q shows 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 테스트가 빌드를 실패시키나요?

기본값으로는 아닙니다. 하지만 fail-on-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
업데이트
2026. 10. 9.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬