decorators
できること
このスキルは、Ginkgoの実行方法やテストの選び方を変えるデコレーターの解説書です。適切なオプションが必要なGo言語のGinkgoテストの作成者向けです。
使う場面
- ✓一部のGinkgoテストを一つずつ、または決まった順序で実行したいとき。
- ✓ラベルを付けて、テストの一部だけを実行できるようにしたいとき。
- ✓遅いテストに、タイムアウトや再試行の設定が必要なとき。
スキルのリンク
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/decorators/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このGinkgoテストを並列にせず単独で実行し、タイムアウトを30秒に設定してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、各ノードに適したデコレーターを選びます。たとえば、並列を無効にするならSerial、時間制限ならNodeTimeoutです。また、各デコレーターをどの種類のブロックに付けられるかも確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Ginkgo decorator reference
Terse lookup. Decorators are passed alongside a node's text/closure: It("...", Serial, Label("slow"), func(){...}). Most attach to containers and/or subjects; some are setup-only or interruptible-only. Decorators on a container apply to all nodes within it; the innermost/most-specific wins when they conflict. Full docs: https://onsi.github.io/ginkgo/#decorator-reference.
Execution / ordering
Serial(container, subject) — never runs in parallel; Ginkgo runs serial specs last, on process #1. →ginkgo:parallelism.Ordered(container only) — child specs run in definition order, never reordered; enablesBeforeAll/AfterAll. →ginkgo:ordering-and-flakes.ContinueOnFailure(outermostOrderedcontainer only) — a failing spec doesn't skip the rest of the ordered group.OncePerOrdered(setup nodes) — makes aBeforeEach/AfterEachrun once around anOrderedcontainer (like aBeforeAll) instead of per-spec.SpecPriority(int)(container, subject) — hint to run higher-priority specs earlier; use sparingly, not to impose a total order.
Selection / filtering (→ ginkgo:filtering)
Label("a", "b")(container, subject) — tag specs for--label-filter; labels union down the hierarchy. No&|!,()/"chars.Focus(container, subject) — run only focused specs; don't commit it (CI exits non-zero). Constructors:FDescribe,FContext,FIt,FEntry.Pending(container, subject) — never run (and never compiled into the run set); no closure needed. Constructors:PDescribe,XDescribe,PIt,XIt,PEntry.SemVerConstraint(">= 2.0.0", ...)/ComponentSemVerConstraint("redis", ">= 8.0.0")(container, subject) — run only when--sem-ver-filtersatisfies the constraint; children may narrow, not widen.
Flakiness / repetition (→ ginkgo:ordering-and-flakes)
FlakeAttempts(n)(container, subject) — retry a failing spec up tontimes; a later pass marks it flaky, not failed. CLI--flake-attempts=noverrides.MustPassRepeatedly(n)(container, subject) — the spec must passntimes in a row to count as passed.
Timeouts / interruption (interruptible nodes — those taking ctx SpecContext; → ginkgo:timeouts-and-async)
NodeTimeout(d)(subject, setup,DeferCleanup/DeferOnFailure) — deadline for a single interruptible node.SpecTimeout(d)(Itonly) — deadline for the whole spec (all its nodes combined).GracePeriod(d)(subject, setup,DeferCleanup/DeferOnFailure) — how long Ginkgo waits for an interrupted node to return before leaking it; overrides--grace-period.
Progress reporting (→ ginkgo:debugging-failures)
PollProgressAfter(d)(subject, setup) — emit a progress report if the node runs longer thand;0disables.PollProgressInterval(d)(subject, setup) — interval between progress reports once they start.SuppressProgressReporting(subject, setup) — silence progress reports for this node.
Wrapping / advanced
AroundNode(fn)(any node, incl.RunSpecs) — wrap a node's execution; forms a stack on a container applied to every descendant node (unlikeBeforeEach, which runs once per spec). Forms: a barefunc(), a context transformerfunc(context.Context) context.Context, or a full wrapperfunc(ctx, func(context.Context)).
Location / identity (rarely needed by hand)
Offset(n)(any node) — skipnstack frames when computing the reported code location. PreferGinkgoHelper()inside helper funcs instead.CodeLocation(loc)(any node) — supply atypes.CodeLocationexplicitly.
Tables
EntryDescription("format %d")— auto-formatEntrydescriptions from their parameters; usable table-wide or per-entry. →ginkgo:tables-and-dynamic-specs.Entry/Italso acceptLabel,Focus,Pending,FlakeAttempts, etc. — every decorator above works on table entries.
Reporting
ReportEntryVisibility{Always,FailureOrVerbose,Never}— passed toAddReportEntryto control console emission. →ginkgo:reporting.
よくある質問
デコレーターはテストのグループ全体に付けられますか?
一部は可能です。このスキルは、グループに付けられるものと、個々のテストにだけ付けられるものを示しています。
二つのデコレーターが競合したらどうなりますか?
テストに最も近い、より具体的なものが優先されます。
Focusはコミットしてよいですか?
いいえ。Focusを残すとCIが失敗するため、コミットしないようこのスキルは勧めています。
詳細
作者による元の説明
One-line reference for every Ginkgo decorator, grouped by what it does, with the node types each can decorate — Serial, Ordered, ContinueOnFailure, OncePerOrdered, Label, Focus, Pending, FlakeAttempts, MustPassRepeatedly, NodeTimeout, SpecTimeout, GracePeriod, PollProgressAfter/Interval, SuppressProgressReporting, SpecPriority, SemVerConstraint, AroundNode, Offset/CodeLocation, EntryDescription. Use to look up a decorator's exact name, semantics, and where it's legal.
repo: onsi/ginkgo
人気
- GitHubのスター
- 9.1k
- ランキング
- #12300
- ライセンス
- MIT
- 更新日
- 2026/10/9
コメント
- …
このリポジトリの他のスキル
ci
9.1kエージェントが、GinkgoのテストをCIで確実に動かせるよう設定を支援します。保留やフォーカスの取り残し、不安定なテストを見つける推奨フラグも含みます。
debugging-failures
9.1kエージェントが、要約の一行を読み、JSONレポートから失敗したテストとメッセージを取り出して、Ginkgoのテストが失敗した理由を見つけられるよう支援します。
filtering
9.1kエージェントが、保留、スキップ、フォーカス、ラベル、バージョン条件、ファイルのフィルターを正しい優先順位で使い、Ginkgoのテストの一部だけを実行できるよう支援します。
ordering-and-flakes
9.1kエージェントが、GinkgoのSerialとOrderedの設定と再試行オプションを使い、Goのテストの実行順序と不安定なテストを管理できるよう支援します。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。