Skip to content

Commit c2899f3

Browse files
authored
chore: re-export AsymmetricMatcher from @jest/expect (#12410)
1 parent 322872f commit c2899f3

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade jsdom to 19.0.0 ([#12290](https://github.com/facebook/jest/pull/12290))
1111
- `[jest-environment-jsdom]` [**BREAKING**] Add default `browser` condition to `exportConditions` for `jsdom` environment ([#11924](https://github.com/facebook/jest/pull/11924))
1212
- `[jest-environment-node]` [**BREAKING**] Add default `node` and `node-addon` conditions to `exportConditions` for `node` environment ([#11924](https://github.com/facebook/jest/pull/11924))
13-
- `[@jest/expect]` [**BREAKING**] New module which extends `expect` with `jest-snapshot` matchers ([#12404](https://github.com/facebook/jest/pull/12404))
13+
- `[@jest/expect]` New module which extends `expect` with `jest-snapshot` matchers ([#12404](https://github.com/facebook/jest/pull/12404), [#12410](https://github.com/facebook/jest/pull/12410))
1414
- `[@jest/expect-utils]` New module exporting utils for `expect` ([#12323](https://github.com/facebook/jest/pull/12323))
1515
- `[jest-resolver]` [**BREAKING**] Add support for `package.json` `exports` ([11961](https://github.com/facebook/jest/pull/11961))
1616
- `[jest-resolve, jest-runtime]` Add support for `data:` URI import and mock ([#12392](https://github.com/facebook/jest/pull/12392))
@@ -36,6 +36,7 @@
3636
- `[docs, examples]` Update React examples to match with the new React guidelines for code examples ([#12217](https://github.com/facebook/jest/pull/12217))
3737
- `[expect]` [**BREAKING**] Remove support for importing `build/utils` ([#12323](https://github.com/facebook/jest/pull/12323))
3838
- `[expect]` [**BREAKING**] Migrate to ESM ([#12344](https://github.com/facebook/jest/pull/12344))
39+
- `[expect]` [**BREAKING**] Snapshot matcher types are moved to `@jest/expect` ([#12404](https://github.com/facebook/jest/pull/12404))
3940
- `[jest-cli]` Update `yargs` to v17 ([#12357](https://github.com/facebook/jest/pull/12357))
4041
- `[jest-config]` [**BREAKING**] Remove `getTestEnvironment` export ([#12353](https://github.com/facebook/jest/pull/12353))
4142
- `[@jest/core]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))

packages/jest-expect/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# @jest/expect
22

3-
This package extends `expect` library with `jest-snapshot` matchers. It export `jestExpect` object, which can be used as standalone replacement of `expect`, and `createJestExpect` factory function, which returns an instance of `jestExpect`.
3+
This package extends `expect` library with `jest-snapshot` matchers. It exports `jestExpect` object, which can be used as standalone replacement of `expect`.
44

55
The `jestExpect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

packages/jest-expect/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import {
1515
} from 'jest-snapshot';
1616
import type {JestExpect} from './types';
1717

18+
export type {AsymmetricMatchers, MatcherFunction, MatcherState} from 'expect';
1819
export type {JestExpect} from './types';
1920

20-
export function createJestExpect(): JestExpect {
21+
function createJestExpect(): JestExpect {
2122
expect.extend({
2223
toMatchInlineSnapshot,
2324
toMatchSnapshot,

packages/jest-jasmine2/src/types.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import type {AssertionError} from 'assert';
9-
import type {JestExpect} from '@jest/expect';
9+
import type {AsymmetricMatchers, JestExpect} from '@jest/expect';
1010
import type CallTracker from './jasmine/CallTracker';
1111
import type Env from './jasmine/Env';
1212
import type JsApiReporter from './jasmine/JsApiReporter';
@@ -69,8 +69,7 @@ export type Jasmine = {
6969
version: string;
7070
testPath: string;
7171
addMatchers: (matchers: JasmineMatchersObject) => void;
72-
} & JestExpect &
73-
typeof globalThis;
72+
} & AsymmetricMatchers & {process: NodeJS.Process};
7473

7574
declare global {
7675
namespace NodeJS {

0 commit comments

Comments
 (0)