@@ -1868,6 +1868,16 @@ added:
18681868Shorthand for marking a suite as ` TODO ` . This is the same as
18691869[ ` suite([name], { todo: true }[, fn]) ` ] [ suite options ] .
18701870
1871+ ## ` suite.flaky([name][, options][, fn]) `
1872+
1873+ <!-- YAML
1874+ added:
1875+ - REPLACEME
1876+ -->
1877+
1878+ Shorthand for marking a suite as flaky. This is the same as
1879+ [ ` suite([name], { flaky: true }[, fn]) ` ] [ suite options ] .
1880+
18711881## ` suite.only([name][, options][, fn]) `
18721882
18731883<!-- YAML
@@ -1939,6 +1949,14 @@ changes:
19391949 * ` todo ` {boolean|string} If truthy, the test marked as ` TODO ` . If a string
19401950 is provided, that string is displayed in the test results as the reason why
19411951 the test is ` TODO ` . ** Default:** ` false ` .
1952+ * ` flaky ` {boolean|number} If ` true ` , the test (or, for a suite, each of its
1953+ test-cases) is retried until it passes, up to a default of 20 retries. If a
1954+ positive integer is provided, it is retried up to that many times. A
1955+ non-positive or non-integer value throws. Each retry re-runs the test's
1956+ ` beforeEach ` and ` afterEach ` hooks. A test-case's own value overrides one
1957+ inherited from its suite; ` flaky: false ` opts out. Retries are intended for
1958+ tests that fail intermittently due to transient conditions; be aware that
1959+ non-idempotent state may leak between attempts. ** Default:** ` false ` .
19421960 * ` timeout ` {number} A number of milliseconds the test will fail after.
19431961 If unspecified, subtests inherit this value from their parent.
19441962 ** Default:** ` Infinity ` .
@@ -2000,6 +2018,16 @@ same as [`test([name], { todo: true }[, fn])`][it options].
20002018Shorthand for marking a test as ` only ` ,
20012019same as [ ` test([name], { only: true }[, fn]) ` ] [ it options ] .
20022020
2021+ ## ` test.flaky([name][, options][, fn]) `
2022+
2023+ <!-- YAML
2024+ added:
2025+ - REPLACEME
2026+ -->
2027+
2028+ Shorthand for marking a test as flaky,
2029+ same as [ ` test([name], { flaky: true }[, fn]) ` ] [ it options ] .
2030+
20032031## ` describe([name][, options][, fn]) `
20042032
20052033Alias for [ ` suite() ` ] [ ] .
@@ -2027,6 +2055,16 @@ added:
20272055Shorthand for marking a suite as ` only ` . This is the same as
20282056[ ` describe([name], { only: true }[, fn]) ` ] [ describe options ] .
20292057
2058+ ## ` describe.flaky([name][, options][, fn]) `
2059+
2060+ <!-- YAML
2061+ added:
2062+ - REPLACEME
2063+ -->
2064+
2065+ Shorthand for marking a suite as flaky. This is the same as
2066+ [ ` describe([name], { flaky: true }[, fn]) ` ] [ describe options ] .
2067+
20302068## ` it([name][, options][, fn]) `
20312069
20322070<!-- YAML
@@ -2066,6 +2104,16 @@ added:
20662104Shorthand for marking a test as ` only ` ,
20672105same as [ ` it([name], { only: true }[, fn]) ` ] [ it options ] .
20682106
2107+ ## ` it.flaky([name][, options][, fn]) `
2108+
2109+ <!-- YAML
2110+ added:
2111+ - REPLACEME
2112+ -->
2113+
2114+ Shorthand for marking a test as flaky,
2115+ same as [ ` it([name], { flaky: true }[, fn]) ` ] [ it options ] .
2116+
20692117## ` before([fn][, options]) `
20702118
20712119<!-- YAML
@@ -3539,6 +3587,9 @@ Emitted when code coverage is enabled and all tests have completed.
35393587 * ` testNumber ` {number} The ordinal number of the test.
35403588 * ` todo ` {string|boolean|undefined} Present if [ ` context.todo ` ] [ ] is called
35413589 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
3590+ * ` retryCount ` {number|undefined} The number of retries performed for a test
3591+ marked ` flaky ` (` 0 ` if it passed on the first attempt). ` undefined ` for
3592+ tests that are not flaky.
35423593
35433594Emitted when a test completes its execution.
35443595This event is not emitted in the same order as the tests are
@@ -3647,6 +3698,9 @@ Emitted when a test is enqueued for execution.
36473698 * ` testNumber ` {number} The ordinal number of the test.
36483699 * ` todo ` {string|boolean|undefined} Present if [ ` context.todo ` ] [ ] is called
36493700 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
3701+ * ` retryCount ` {number|undefined} The number of retries performed for a test
3702+ marked ` flaky ` (` 0 ` if it passed on the first attempt). ` undefined ` for
3703+ tests that are not flaky.
36503704
36513705Emitted when a test fails.
36523706This event is guaranteed to be emitted in the same order as the tests are
@@ -3712,6 +3766,9 @@ since the parent runner only knows about file-level tests. When using
37123766 * ` testNumber ` {number} The ordinal number of the test.
37133767 * ` todo ` {string|boolean|undefined} Present if [ ` context.todo ` ] [ ] is called
37143768 * ` skip ` {string|boolean|undefined} Present if [ ` context.skip ` ] [ ] is called
3769+ * ` retryCount ` {number|undefined} The number of retries performed for a test
3770+ marked ` flaky ` (` 0 ` if it passed on the first attempt). ` undefined ` for
3771+ tests that are not flaky.
37153772
37163773Emitted when a test passes.
37173774This event is guaranteed to be emitted in the same order as the tests are
@@ -4527,6 +4584,14 @@ changes:
45274584 * ` todo ` {boolean|string} If truthy, the test marked as ` TODO ` . If a string
45284585 is provided, that string is displayed in the test results as the reason why
45294586 the test is ` TODO ` . ** Default:** ` false ` .
4587+ * ` flaky ` {boolean|number} If ` true ` , the test (or, for a suite, each of its
4588+ test-cases) is retried until it passes, up to a default of 20 retries. If a
4589+ positive integer is provided, it is retried up to that many times. A
4590+ non-positive or non-integer value throws. Each retry re-runs the test's
4591+ ` beforeEach ` and ` afterEach ` hooks. A test-case's own value overrides one
4592+ inherited from its suite; ` flaky: false ` opts out. Retries are intended for
4593+ tests that fail intermittently due to transient conditions; be aware that
4594+ non-idempotent state may leak between attempts. ** Default:** ` false ` .
45304595 * ` timeout ` {number} A number of milliseconds the test will fail after.
45314596 If unspecified, subtests inherit this value from their parent.
45324597 ** Default:** ` Infinity ` .
0 commit comments