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: create new @jest/expect package #12404

Merged
merged 21 commits into from Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion packages/jest-expect/__typetests__/jest-expect.test.ts
Expand Up @@ -13,14 +13,15 @@ import {
} from 'tsd-lite';
import {jestExpect} from '@jest/expect';
import {expect} from 'expect';
import type {Plugin} from 'pretty-format';

expectType<void>(jestExpect({}).toMatchSnapshot());

expectError(() => {
expect({}).toMatchSnapshot();
});

expectType<void>(jestExpect.addSnapshotSerializer({} as any));
expectType<void>(jestExpect.addSnapshotSerializer({} as Plugin));

expectError(() => {
expect.addSnapshotSerializer();
Expand Down
1 change: 1 addition & 0 deletions packages/jest-expect/src/types.ts
Expand Up @@ -16,6 +16,7 @@ export type JestExpect = {
<T = unknown>(actual: T): JestMatchers<void, T> &
Inverse<JestMatchers<void, T>> &
PromiseMatchers<T>;
addSnapshotSerializer: typeof addSerializer;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds duplication, but it helps to work around the problem. Type is aded here to be visible for the user, but also left in augmentation to avoid casting in code. I will follow the issue in api-extractor and will clean up after it will be solved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment above it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above this line, that is

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(done)

SimenB marked this conversation as resolved.
Show resolved Hide resolved
} & BaseExpect &
AsymmetricMatchers &
Inverse<Omit<AsymmetricMatchers, 'any' | 'anything'>>;
Expand Down