feat(test): add test.describe.only and the only option on describe
Closed
AK
8d ago+360+360+012345678901234567890123456789-40-40-01234567890123456789
What and why
- Adds
test.describe.only(title, fn)and theonlyoption ondescribe, thetest.describe.only('checkout', fn)item of #1855. - A test inside a focused group registers with the same
onlymodetest.onlysets (packages/e2e/src/collect/registry.ts), so the existing focus rules and the CI rejection (ONLY_IN_CI) apply unchanged. - The innermost
onlywins:only: falseon an inner group or a test opts it out. A skipped test or group stays unfocused andfiltered, as besidetest.only. - A serial group can be focused whole;
onlyinside one is aCOLLECTION_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.
| main | this branch |
|---|---|
COLLECTION_ERROR: describe.only is not a function | the 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 atest.only, andONLY_IN_CI), plus unit tests inregistry.test.tsandselect.test.ts. - The ja and zh reference pages keep the new
describe.onlysection in English, as they do fordescribe.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/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
🤖 Generated with Claude Code