Skip to content

Commit

Permalink
feat(circus): added each to failing tests (#13142)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkyusuftk authored Aug 17, 2022
1 parent a5b52a5 commit 7d8d01c
Show file tree
Hide file tree
Showing 14 changed files with 430 additions and 84 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

- `[expect]` [**BREAKING**] Differentiate between `MatcherContext` `MatcherUtils` and `MatcherState` types ([#13141](https://github.com/facebook/jest/pull/13141))
- `[jest-circus]` Add support for `test.failing.each` ([#13142](https://github.com/facebook/jest/pull/13142))
- `[jest-config]` [**BREAKING**] Make `snapshotFormat` default to `escapeString: false` and `printBasicPrototype: false` ([#13036](https://github.com/facebook/jest/pull/13036))
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade to `jsdom@20` ([#13037](https://github.com/facebook/jest/pull/13037), [#13058](https://github.com/facebook/jest/pull/13058))
- `[@jest/globals]` Add `jest.Mocked`, `jest.MockedClass`, `jest.MockedFunction` and `jest.MockedObject` utility types ([#12727](https://github.com/facebook/jest/pull/12727))
Expand Down
24 changes: 24 additions & 0 deletions docs/GlobalAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,30 @@ test.failing('it is equal', () => {
});
```

### `test.failing.each(name, fn, timeout)`

Also under the alias: `it.failing.each(table)(name, fn)` and `` it.failing.each`table`(name, fn) ``

:::note

This is only available with the default [jest-circus](https://github.com/facebook/jest/tree/main/packages/jest-circus) runner.

:::

You can also run multiple tests at once by adding `each` after `failing`.

Example:

```js
test.failing.each([
{a: 1, b: 1, expected: 2},
{a: 1, b: 2, expected: 3},
{a: 2, b: 1, expected: 3},
])('.add($a, $b)', ({a, b, expected}) => {
expect(a + b).toBe(expected);
});
```

### `test.only.failing(name, fn, timeout)`

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

0 comments on commit 7d8d01c

Please sign in to comment.