Repository navigation
feat(test): add test.describe.fail and the fail option on describe - #1925
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 16 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Checked at 3dc828d (main 6fbcb66): code, docs, types, tests, and Playwright 1.65.1 test.d.ts for parity. Clean merge on main. Nice work, the resolution goes through the one resolveOptions path every consumer (runner, reports, MCP) already reads, and the serial rules match the test-level ones.
Must fix
None.
Should fix
packages/e2e/src/collect/registry.ts:700- theas DescribeAPIcast isn't needed. GivegroupRegistrara: DescribeRegistrarreturn type (asregistrarhas: TestRegistrar) and writeconst describe: DescribeAPI = Object.assign(...).tsc --noEmitpasses inpackages/e2ewith that change, so the compiler checks the call forms instead of trusting the cast.packages/core/src/internal/expected-failure.ts:42- Playwright's group form istest.fail(condition, 'reason')called in a describe body (there is notest.describe.failupstream), so a migrating user hits this collection error first. It still says to "use test.fail(title, fn) or pass { fail: true } ... as the test option". Point it atdescribe.fail(title, fn)/describe(title, { fail: 'reason' }, fn)too.
Nits
- A group mark that passes still reports
test is marked test.fail (...) but passed. Fine as it is, butdescribe.failusers may not find the mark on the test. Up to you. - ja/zh prose: English placeholders are allowed by the translation rules and
docs:checkpasses, so the cubic threads are not blockers. Applying cubic's two ready-made migrate-row suggestions costs nothing, though. - Migrate row: Playwright users usually mark a group conditionally (
test.fail(({ browserName }) => ..., 'reason')). Collection runs the same on every platform, so the e2e equivalent isbeforeEach(({ platform }) => test.fail(platform === 'web', 'reason')). A short hint in that row would save a search.
Verified
vitest run tests/unit/registry.test.ts tests/unit/select.test.ts tests/integration/expected-failure.test.ts: 104/104 pass.tsc --noEmitinpackages/e2e(includestests/types/sdk-types.ts) is clean.oxlint,docs:check(translations outline),check:changeset-bumps, andplugins:checkall pass.- Mutants, each killed by a new test: group layers ignored (back to
test.options.fail), outer reason wins, no "serial inside a fail group" check, no "fail on a serial group" check,describe.failnot addingfail: true. - cubic select.test thread: really fixed. The
'coupon API'inner-group case catches the outer-wins mutant. - Fork CI is still waiting for approval. Only check/label/pr-size ran (green).
|
Thanks for the review. Pushed d387d0a:
|
There was a problem hiding this comment.
0 issues found across 6 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at d387d0a against main 847a09e. All three earlier asks are done, and nothing new turned up in the new commits.
Must fix
- Rebase on main. #1891 (on-demand and worker fixtures) landed, and the PR now conflicts in
packages/core/src/types.ts,packages/e2e/src/collect/registry.tsanddocs/{,ja/,zh/}reference/test.mdx. Both code conflicts are mechanical:types.ts:TestAPIis nowTestAPI<Fixtures, Worker>. Keep main'sextend<Extra, ExtraWorker>and itsbeforeEach/afterEach/beforeAll/afterAllsignatures (TestHookFn<Fixtures & Worker>/TestHookFn<Worker>, notSuiteHookFn), and replace only the twodescribeoverloads withdescribe: DescribeAPI.registry.ts: drop main's inlinedescribe()method for yourdescribe, and keep main'sbeforeEach(fn: TestBody)typing (TestBodyis main's alias forTestHookFn<object>).- Re-run
tsc --noEmitinpackages/e2eafter the rebase, sincetests/types/sdk-types.tsalso auto-merges with #1891's changes.
Should fix
None.
Verified
- Earlier asks: the
as DescribeAPIcast is gone (groupRegistrar(...): DescribeRegistrar,const describe: DescribeAPI = ...). The collection error now namesdescribe.fail(title, fn)and the describe option. The migrate row has the conditionaltest.fail(condition, 'reason')inbeforeEachform, which matches how abeforeEachmark already works. cubic's ja/zh rows are applied. Leaving the UNEXPECTED_PASS wording as is works for me. vitest run tests/unit/registry.test.ts tests/unit/select.test.ts tests/integration/expected-failure.test.ts: 104/104.tsc --noEmitinpackages/e2eis clean.- Mutant: I reverted the collection-error text in
core/src/internal/expected-failure.tsand rebuilt core. The newregistry.test.tsassertion fails, so it bites. - #1891 interaction: none beyond the conflicts.
resolveOptionsinselect.tsmerges cleanly. AbeforeAll(now with worker fixtures) that fails inside adescribe.failgroup is still a suite-phase error and not an expected failure, the same as for a{ fail }test today. - cubic: no open findings. The 0-issue pass ran at d387d0a.
- CI: fork CI at d387d0a still waits for approval. Only check/label/drop/cubic ran, all green.
d387d0a to
dbd8906
Compare
|
Rebased on main (402a615), now dbd8906. Took main's side in both conflicts and swapped only the two |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at dbd8906 against main ae36939. The rebase on 402a615 was clean and the earlier asks still hold. #1882 (test.each/test.for) landed after it, though, so the PR conflicts again.
Must fix
- Rebase on main again. #1882 conflicts in two places, both "keep both sides":
packages/e2e/src/collect/registry.ts: the type import needsDescribeRegistrarplus main'sEachFnandEachRegistrar. After main'seachRegistrar, keep yourgroupRegistrar+const describe: DescribeAPI.packages/e2e/tests/types/sdk-types.ts: keep main'stest.each/test.forblock. Then swap main's trailing// fail takes the same three shapes ...; describe and setup take no fail option.comment for your version, sincedescribenow takesfail.types.ts, the docs and the skills auto-merge.
Should fix
None.
Verified (on a local merge of the PR into main with the conflicts resolved as above)
tsc --noEmitinpackages/e2eis clean.oxlinton the touched sources is clean.docs:check(180/180 translations),docs:check-errors,check:changeset-bumpsandplugins:checkpass.vitest run tests/unit+ therunner-lifecycle,test-source,on-demand-fixturesandexpected-failureintegration suites: 4216 passed, 2 skipped. A first run had one failure that did not come back on the re-run (shared machine).- Composition with #1882: a scratch case had
test.eachrows insidedescribe.failanddescribe(..., { fail: 'why' }), plus atest.forrow with its ownfail. Each row resolved to the expected reason. Dropping thefail: truethatdescribe.failadds makes that case fail. - Composition with #1891 (fixture pool): nothing new since the last check.
resolveOptionsstays the one path for the mark. - Earlier asks at this head: no
as DescribeAPIcast, the collection error points atdescribe.failand the describe option, and the migrate row has the conditional form. - Playwright 1.65.1
test.d.ts:test.describehasonly/skip/fixme/serial/parallel/configurebut nofail. The upstream group form istest.fail(condition, reason)in a describe body, and the collection error and migrate row cover it.describe.failis an e2e addition shaped likedescribe.fixme. Fine. - cubic: no open findings. CI: fork CI at dbd8906 waits for approval (spec, docs, docs translations, mobile, benchmark are
action_required). check/label/drop/pr-policy/pr-size are green.
dbd8906 to
794b798
Compare
|
Rebased on main (a5d1788), now 794b798.
After a fresh |
Superseded by the latest automated re-check.
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 794b798 against main a5d1788. The rebase is right. It keeps #1882 and #1921 intact and adds describe.fail on top. Nothing new to fix.
Must fix
None.
Should fix
None.
Verified
- Conflict resolution:
registry.tsimportsDescribeAPI/DescribeRegistrarnext to main'sEachFn/EachRegistrar, and also keeps #1921'ssetRunningTestTimeoutimport.groupRegistrarandconst describe: DescribeAPIcome aftereachRegistrar, with no cast.sdk-types.tskeeps thetest.each/test.forblock and thetest.setTimeoutlines, and has the updatedfailcomment. The migrate gap row losestest.fail()on a describe in en/ja/zh. #1921 already removedtest.setTimeout()from that row, and its own mapping row is still there. - Merges clean into current main.
tsc --noEmitinpackages/e2eis clean once@e2e-dev/webis built.oxlinton the touched sources is clean.docs:check,docs:check-errors,check:changeset-bumpsandplugins:checkpass.vitest run tests/unit+ theexpected-failure,test-set-timeout,runner-lifecycleandtest-sourceintegration suites: 4223 passed, 2 skipped.- Scratch project at this head:
test.eachrows insidedescribe.failpass as expected failures with the default reason.- A
test.forrow with{ fail: 'row reason' }keeps its own reason. - Inside
describe(..., { fail: 'slow gap' }), a test that callstest.setTimeout(300)and then outlasts it, and a test that callstest.setTimeout(5000)and then fails, both pass as expected failures withslow gap. That matches the test-level{ fail, timeout }case inexpected-failure.test.ts.
- Mutants, both killed:
resolveOptionsreads onlytest.options.fail(1 unit failure), anddescribe.faildrops itsfail: true(3 unit failures). - cubic: no open findings. The earlier P2 was fixed. The P3 translation notes do not apply, because translations are best effort.
- CI: fork CI at 794b798 is waiting for approval (
spec,docs,docs translations,mobile,benchmarkareaction_required). check/label/drop/pr-policy/pr-size are green.
|
🤖 gpt-6.2-sol responding on behalf of @KrzysztofMoch Almost ready at
|
|
Thanks, both were real. Fixed in 3d93e93:
|
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Requires human review: Auto-approval skipped because cubic reviewed only this push, not the earlier force-push. Comment @cubic review to review the whole pull request.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 6 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Requires human review: Auto-approval skipped because cubic reviewed only this push, not the earlier force-push. Comment @cubic review to review the whole pull request.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at a4fefa9 against main e88153b. Both of KrzysztofMoch's asks are fixed, and so is the outer-group wording cubic pointed out. The PR now conflicts with main, but only in one migrate table row.
Must fix
None.
Should fix
- Rebase onto main. #1887 rewrote the same gap row in
docs/migrate/playwright.mdx(and ja/zh), so the PR isdirty. The conflict is three one-line hunks and no code. Take main's two rows and drop only, \test.fail()` on a describeandand `test.fail()`, sincedescribe.failnow covers them.registry.ts,select.ts,types.ts,sdk-types.tsand the tests all merge cleanly with #1887'stest.fixme`.
Nits
registry.tsregisterDescribe(title, options, body, api = 'describe()', markFail = false): a positional boolean after a default parameter is easy to misread. A single validation pass that then checksmarkFail && (options.serial === true || insideSerial(parent))would also do away with the second fullvalidateDescribeOptions. Optional.
Verified
describe.fail('group', [], fn)and an object with a non-enumerable bad key now throw the sameunknown keyerror asdescribe().describe.fail('unit', { serial: true }, fn)throws the serial rule.- The "truthy layer" wording is gone from
TestOptions.failJSDoc, thefailoption section, and both skill copies. They now say "trueor any string" and "on, inside, or around a serial group". - Mutants, both killed by
registry.test.ts: putting the{ ...given, fail: true }spread back fails the describe.fail test, and dropping the second validation pass fails the serial test. - On a local merge of the PR into main,
tsc --noEmitand oxlint on the touched sources are clean.vitest run tests/unitpasses: 4217 passed, 2 skipped. Theexpected-failure,runner-lifecycle,test-set-timeoutandstep-holdintegration suites pass: 81 tests. - Scratch run of fail with fixme on the merged tree. In every case below the skip wins, as in Playwright:
test.fixme(title, fn)insidedescribe.failis skipped with causefixme.- Runtime
test.fixme(true)insidedescribe.failis skipped with causefixme. test.fixme(false)followed by a failure passes as an expected failure.test.fail(title)in a{ skip: 'fixme' }group is skipped with causeexplicit.test.fixmeinside{ fail: 'reason' }is skipped.
step-hold.test.tspassed 4/4 runs here, including "fails a held step the body never awaited". The failure you see locally is not on main.- cubic: no open findings. Its ja translation note does not apply, since translations are best effort.
- CI: fork CI at a4fefa9 is waiting for approval (
spec,docs,docs translations,mobile,benchmarkareaction_required). check, drop, label, pr-policy and pr-size are green.
|
[claude-opus-5-5] automated review on behalf of @okwasniewski CI re-check at a4fefa9: the red |
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Posted by mistake by the automated triage script (empty review). Please ignore it; the earlier review still stands.
A test now reads fail from its groups as well as itself. Any truthy layer marks it, the innermost reason wins, and fail: false does not unmark. Refused on, inside, or around a serial group. Part of e2e-inc#1855.
… at describe.fail The collection error for test.fail(condition) outside a body now names describe.fail and the describe option, since a migrating Playwright user hits it first. The Playwright migrate row gains the conditional form, and the ja/zh rows take cubic's translations.
describe.fail copied its options with a spread before validation, so an array or a non-enumerable bad key passed where describe() rejects it. The caller's options are now validated first, then again with fail: true for the serial rules. The fail docs now say true or any string marks, since a blank string marks too.
describe.fail no longer validates twice: the serial check takes the mark into account, and registerDescribe takes api and markFail without defaults.
a4fefa9 to
5a077de
Compare
|
Rebased on main (3e7d19d), now 5a077de.
On the earlier fork CI run at a4fefa9: |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 5a077de, rebased on main 3e7d19d. The rebase and the nit both look right, and CI is green. Nothing left to fix.
Must fix
None.
Should fix
None.
Verified
- #1887 conflict: in en/ja/zh
migrate/playwright.mdx, main's gap row keeps itstest.fixme(title, details, body)entry and theexplicitskip cause note. Only, test.fail() on a describeandand test.fail()are dropped. The new mapping row (describe.fail/{ fail: 'reason' }/test.fail(condition)inbeforeEach) is still there. - Nit done:
registerDescriberunsvalidateDescribeOptions(given, parent, markFail)once and then addsfail: true.apiandmarkFailare required, andregisterDescribehas only one caller. The rules are the same as at 618564f:(markFail || options.fail !== undefined)on or inside a serial group throws, and so does a serial group inside a fail group. - Mutants, both killed by
registry.test.ts: validating the spread copy fails the describe.fail test, and droppingmarkFailfrom the serial check fails the serial test. - At the PR head:
tsc --noEmitinpackages/e2eis clean, and oxlint is clean onsrc/collectand the touched tests.vitest run tests/unitgave 4231 passed and 2 skipped. Theexpected-failure,runner-lifecycleandstep-holdintegration suites gave 76 passed.registry.tsis 935 lines. The diff adds no em or en dashes, and the changeset is a patch. - CI at 5a077de: every check is green, including
teston all five Node versions,spec gate,docs gate,mobile gate,benchmark gate, web, and android/ios deterministic. The earliermoli.test.ts:222failure did not come back.mergeable_stateisclean. - cubic: its check is neutral because the incremental review could not start, so there are no new findings. It has no open findings from earlier runs.
What and why
test.describe.fail('legacy', fn)row of ☂️ Help us bring missing APIs to e2e #1855: mark every test in a group expected to fail.describenow takes thefailoption, the way it already takesskip.describe.fail(title, fn)is shorthand forfail: true, astest.fail(title, fn)is for a test. A reason goes in the option.failfrom its groups as well as itself (packages/e2e/src/collect/select.ts:165). Any truthy layer marks it and the innermost reason wins.fail: falsedoes not unmark, same asskip.UNEXPECTED_PASS.Issue
Part of #1855 (Test runner:
test.describe.fail('legacy', fn)).Verified
Ran it locally: yes
A small page in Chromium through the built CLI (
node packages/e2e/dist/cli/bin.js run): the legacy card payment is broken, the coupon was fixed, refunds were never ported.report.jsoncarries each result'sexpectedFailurereason, and none on the test outside the groups.describe.failstops the run before anything executes (exit 2):a serial group cannot sit inside a group marked fail; its members cannot be expected to fail.Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.🤖 Generated with Claude Code