Skip to content
Skillpedia
Testing9.1k Β· #12300

decorators

What it does

This skill is a reference for the decorators that change how Ginkgo runs or selects tests. It is for developers writing Go tests with Ginkgo who need the right option.

When to use it

  • βœ“When you want certain Ginkgo tests to run one at a time or in a fixed order.
  • βœ“When you want to tag tests with labels so you can run only some of them.
  • βœ“When a slow test needs a timeout or a retry setting.

Skill link

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

Copy 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

Use this skill to help me: https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/decorators/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œMake this Ginkgo test run on its own, not in parallel, with a 30 second timeout.”

5 new skills a week. 1 minute to read.

How it works

The agent picks the right decorator for each node, such as Serial for no parallel runs or NodeTimeout for a time limit, and checks which kinds of blocks each decorator can be placed on.

Technical content (original SKILL.md)

Original text by the author, straight from 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; enables BeforeAll/AfterAll. β†’ ginkgo:ordering-and-flakes.
  • ContinueOnFailure (outermost Ordered container only) β€” a failing spec doesn't skip the rest of the ordered group.
  • OncePerOrdered (setup nodes) β€” makes a BeforeEach/AfterEach run once around an Ordered container (like a BeforeAll) 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-filter satisfies the constraint; children may narrow, not widen.

Flakiness / repetition (β†’ ginkgo:ordering-and-flakes)

  • FlakeAttempts(n) (container, subject) β€” retry a failing spec up to n times; a later pass marks it flaky, not failed. CLI --flake-attempts=n overrides.
  • MustPassRepeatedly(n) (container, subject) β€” the spec must pass n times 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) (It only) β€” 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 than d; 0 disables.
  • 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 (unlike BeforeEach, which runs once per spec). Forms: a bare func(), a context transformer func(context.Context) context.Context, or a full wrapper func(ctx, func(context.Context)).

Location / identity (rarely needed by hand)

  • Offset(n) (any node) β€” skip n stack frames when computing the reported code location. Prefer GinkgoHelper() inside helper funcs instead.
  • CodeLocation(loc) (any node) β€” supply a types.CodeLocation explicitly.

Tables

  • EntryDescription("format %d") β€” auto-format Entry descriptions from their parameters; usable table-wide or per-entry. β†’ ginkgo:tables-and-dynamic-specs.
  • Entry/It also accept Label, Focus, Pending, FlakeAttempts, etc. β€” every decorator above works on table entries.

Reporting

  • ReportEntryVisibility{Always,FailureOrVerbose,Never} β€” passed to AddReportEntry to control console emission. β†’ ginkgo:reporting.
FAQ

Can decorators apply to a whole group of tests?

Some can. The skill notes which decorators work on a group and which work on single tests.

What happens if two decorators conflict?

The most specific one, closest to the test, takes precedence.

Should Focus be committed?

No. The skill says not to commit Focus, since CI fails when it is left in.

Details

Original description by the author

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

Popularity

GitHub stars
9.1k
Ranking position
#12300
License
MIT
Updated
10/9/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills