Skip to content

Conversation

@mrazauskas
Copy link
Contributor

From #13283 (comment)

Summary

Here is a quick idea how expect could be removed from the dev dependencies of pretty-format.

expect is needed only for one test, which is testing DummyMatcher class which is defined in the test file. This class is extending AsymmetricMatcher abstract class which is imported from expect.

The imported AsymmetricMatcher abstract class looks like this:

https://github.com/facebook/jest/blob/561907ce5d1e9065311cf585f75b9c5864036193/packages/expect/src/asymmetricMatchers.ts#L67-L89

All what the test needs is toAsymmetricMatcher method, but as one can see above it is not implemented in the parent class. This means that only the constructor and $$typeof property of AsymmetricMatcher are useful. I think we can safely copy these to DummyMatcher class and remove expect as a dependency. Or?

Test plan

Green CI.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

nice! 👍

@SimenB SimenB merged commit 5643106 into jestjs:main Sep 21, 2022
@mrazauskas mrazauskas deleted the chore-pretty-format-deps branch September 21, 2022 08:00
@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 Oct 22, 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