Skip to content

Commit 7d8d01c

Browse files
authored
feat(circus): added each to failing tests (#13142)
1 parent a5b52a5 commit 7d8d01c

File tree

14 files changed

+430
-84
lines changed

14 files changed

+430
-84
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Features
44

55
- `[expect]` [**BREAKING**] Differentiate between `MatcherContext` `MatcherUtils` and `MatcherState` types ([#13141](https://github.com/facebook/jest/pull/13141))
6+
- `[jest-circus]` Add support for `test.failing.each` ([#13142](https://github.com/facebook/jest/pull/13142))
67
- `[jest-config]` [**BREAKING**] Make `snapshotFormat` default to `escapeString: false` and `printBasicPrototype: false` ([#13036](https://github.com/facebook/jest/pull/13036))
78
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade to `jsdom@20` ([#13037](https://github.com/facebook/jest/pull/13037), [#13058](https://github.com/facebook/jest/pull/13058))
89
- `[@jest/globals]` Add `jest.Mocked`, `jest.MockedClass`, `jest.MockedFunction` and `jest.MockedObject` utility types ([#12727](https://github.com/facebook/jest/pull/12727))

docs/GlobalAPI.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,30 @@ test.failing('it is equal', () => {
763763
});
764764
```
765765

766+
### `test.failing.each(name, fn, timeout)`
767+
768+
Also under the alias: `it.failing.each(table)(name, fn)` and `` it.failing.each`table`(name, fn) ``
769+
770+
:::note
771+
772+
This is only available with the default [jest-circus](https://github.com/facebook/jest/tree/main/packages/jest-circus) runner.
773+
774+
:::
775+
776+
You can also run multiple tests at once by adding `each` after `failing`.
777+
778+
Example:
779+
780+
```js
781+
test.failing.each([
782+
{a: 1, b: 1, expected: 2},
783+
{a: 1, b: 2, expected: 3},
784+
{a: 2, b: 1, expected: 3},
785+
])('.add($a, $b)', ({a, b, expected}) => {
786+
expect(a + b).toBe(expected);
787+
});
788+
```
789+
766790
### `test.only.failing(name, fn, timeout)`
767791

768792
Also under the aliases: `it.only.failing(name, fn, timeout)`, `fit.failing(name, fn, timeout)`

0 commit comments

Comments
 (0)