feat(test): add test.describe.only and the only option on describe

Closed
AK
8d ago
+360-40

What and why

  • Adds test.describe.only(title, fn) and the only option on describe, the test.describe.only('checkout', fn) item of #1855.
  • A test inside a focused group registers with the same only mode test.only sets (packages/e2e/src/collect/registry.ts), so the existing focus rules and the CI rejection (ONLY_IN_CI) apply unchanged.
  • The innermost only wins: only: false on an inner group or a test opts it out. A skipped test or group stays unfocused and filtered, as beside test.only.
  • A serial group can be focused whole; only inside one is a COLLECTION_ERROR.
describe.only('checkout', () => {
  test('pays by card', async ({ screen }) => {}); // runs
  describe('refunds', () => {
    test('refunds a card', async ({ screen }) => {}); // runs
  });
});
test('signs in', async ({ app }) => {}); // filtered

Issue

Part of #1855 (test.describe.only('checkout', fn), assigned to me).

Verified

Ran it locally: yes

  • testbed, built CLI: a file with a test outside, a describe.only('checkout') group with a nested group, and another unfocused group.
mainthis branch
COLLECTION_ERROR: describe.only is not a functionthe 2 tests in checkout run, nested one included; the rest are filtered
-with CI=1: ONLY_IN_CI
  • New tests: tests/integration/describe-only.test.ts (focused groups beside a test.only, and ONLY_IN_CI), plus unit tests in registry.test.ts and select.test.ts.
  • The ja and zh reference pages keep the new describe.only section in English, as they do for describe.fail; the surrounding sentences and the migrate rows are translated.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

🤖 Generated with Claude Code