Skip to content

Commit

Permalink
feat(jest-expect): re-export Matchers and `MatcherFunctionWithState…
Browse files Browse the repository at this point in the history
…` interface (#12418)
  • Loading branch information
mrazauskas committed Feb 17, 2022
1 parent 76a4a75 commit bb09565
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
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

0 comments on commit bb09565

Please sign in to comment.