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

chore: re-export AsymmetricMatcher from @jest/expect #12410

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Feb 16, 2022

Summary

There might be other types we wanna export as well but at least exporting stuff people might import from expect seems reasonable.

/cc @mrazauskas

Test plan

Green CI

@@ -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]` [**BREAKING**] New module which extends `expect` with `jest-snapshot` matchers ([#12404](https://github.com/facebook/jest/pull/12404))
Copy link
Member Author

Choose a reason for hiding this comment

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

new module in itself isn't breaking 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm.. In a way expect received minimal breaking change. That was the reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, I added a separate entry for it below. Any other breaking changes than the type removal?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

right. that probably should have thrown all along, not be a no-op. Can call it out, tho

export type {JestExpect} from './types';

export function createJestExpect(): JestExpect {
Copy link
Member Author

@SimenB SimenB Feb 16, 2022

Choose a reason for hiding this comment

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

I don't think exporting this is super useful. if it proves to be it's easy to add in the future

@@ -69,7 +69,7 @@ export type Jasmine = {
version: string;
testPath: string;
addMatchers: (matchers: JasmineMatchersObject) => void;
} & JestExpect &
} & AsymmetricMatchers &
Copy link
Member Author

Choose a reason for hiding this comment

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

we just do this for .any etc

@@ -69,8 +69,7 @@ export type Jasmine = {
version: string;
testPath: string;
addMatchers: (matchers: JasmineMatchersObject) => void;
} & JestExpect &
typeof globalThis;
} & AsymmetricMatchers & {process: NodeJS.Process};
Copy link
Member Author

@SimenB SimenB Feb 16, 2022

Choose a reason for hiding this comment

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

globalThis only used for process, so let's be a bit more precise

@SimenB SimenB merged commit c2899f3 into jestjs:main Feb 16, 2022
@SimenB SimenB deleted the re-export-asymmetric-matchers branch February 16, 2022 18:03
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants