Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jest-expect): re-export Matchers and MatcherFunctionWithState interface #12418

Merged
merged 5 commits into from Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -10,7 +10,7 @@
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade jsdom to 19.0.0 ([#12290](https://github.com/facebook/jest/pull/12290))
- `[jest-environment-jsdom]` [**BREAKING**] Add default `browser` condition to `exportConditions` for `jsdom` environment ([#11924](https://github.com/facebook/jest/pull/11924))
- `[jest-environment-node]` [**BREAKING**] Add default `node` and `node-addon` conditions to `exportConditions` for `node` environment ([#11924](https://github.com/facebook/jest/pull/11924))
- `[@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))
- `[@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), [#12418](https://github.com/facebook/jest/pull/12418))
- `[@jest/expect-utils]` New module exporting utils for `expect` ([#12323](https://github.com/facebook/jest/pull/12323))
- `[jest-resolver]` [**BREAKING**] Add support for `package.json` `exports` ([11961](https://github.com/facebook/jest/pull/11961))
- `[jest-resolve, jest-runtime]` Add support for `data:` URI import and mock ([#12392](https://github.com/facebook/jest/pull/12392))
Expand Down
4 changes: 2 additions & 2 deletions examples/expect-extend/toBeWithinRange.ts
Expand Up @@ -48,9 +48,9 @@ expect.extend({

declare module 'expect' {
interface AsymmetricMatchers {
toBeWithinRange(a: number, b: number): void;
toBeWithinRange(floor: number, ceiling: number): void;
}
interface Matchers<R> {
toBeWithinRange(a: number, b: number): R;
toBeWithinRange(floor: number, ceiling: number): R;
}
}
6 changes: 6 additions & 0 deletions examples/expect-extend/tsconfig.json
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"strict": true
},
"include": ["./**/*"]
}
8 changes: 7 additions & 1 deletion packages/jest-expect/src/index.ts
Expand Up @@ -15,7 +15,13 @@ import {
} from 'jest-snapshot';
import type {JestExpect} from './types';

export type {AsymmetricMatchers, MatcherFunction, MatcherState} from 'expect';
export type {
AsymmetricMatchers,
Matchers,
MatcherFunction,
MatcherFunctionWithState,
MatcherState,
} from 'expect';
export type {JestExpect} from './types';

function createJestExpect(): JestExpect {
Expand Down