Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents the @gate and @force-gate test directives, which replace it.skip and dev-mode skip guards with conditional test gating.
24% 95%+71 ptsof test cases passed
Passed 20 of 21 test cases with the skill, and 5 of 21 without it.
This test ran on v7. v8 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
@gate / @force-gateFull reference: test/lib/gate/README.md.
This skill is the decision guide: which directive to reach for, the standard
conversion patterns, and how to verify.
| Anti-pattern | Replacement |
|---|---|
it.skip('...') for a known failure | // @gate <cond> (or @gate FIXME if no condition explains it) |
if (isNextDev) { test('skipped in dev mode', () => {}); return } | // @force-gate prefetching (or !dev) on the describe |
(flagEnabled ? describe.skip : describe)(...) keyed on process.env | // @force-gate <cond> (lazy) on the describe |
| Duplicating a fixture directory per flag state | one fixture keyed on __NEXT_TEST_AXIS + a @gate/@force-gate |
Branching expectations on process.env.__NEXT_CACHE_COMPONENTS | if (await gate((c) => c.cacheComponents)) (gate from next-test-utils) |
The skip patterns are fake-greens: nothing tells you when the bug they hide is
fixed. @gate still runs the body and fails the suite the day the "known
failure" starts passing, so stale workarounds get deleted instead of rotting.
Don't add mode gates that the test directory already guarantees:
@gate dev is unnecessary in test/development/: these tests only run in
dev mode.@gate start is unnecessary in test/production/: these tests only run in
production build/start mode.@gate !deploy is unnecessary outside test/e2e/: only test/e2e/ tests
run in deploy mode.The same applies to @force-gate dev, @force-gate start, and
@force-gate !deploy in those respective locations.
Ask what kind of difference you're encoding:
gate() —
same condition registry, no inversion — which pinpoints exactly what
differs, and also covers it.each, where a pragma cannot attach:Next to this one in the catalogue, plus more from the same author.