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

Remove aliased matchers #13192

Closed

Conversation

EduardoSCosta
Copy link
Contributor

Summary

Resolve #13164

This PR:

  • Removes the following matchers aliases:
.toBeCalled();
.toBeCalledTimes();
.toBeCalledWith();
.lastCalledWith();
.nthCalledWith();
.toReturn();
.toReturnTimes();
.toReturnWith();
.lastReturnedWith();
.nthReturnedWith();
.toThrowError();
  • Updates tests to use native matchers;
  • Removes the eliminated matchers from docs.

Test plan

New tests were not needed, but current tests were updated to use the preferred matchers.

@EduardoSCosta EduardoSCosta force-pushed the remove_aliased_matchers branch from 9b2afca to 89b3844 Compare August 30, 2022 13:51
@EduardoSCosta EduardoSCosta marked this pull request as ready for review August 30, 2022 13:53
@SimenB
Copy link
Member

SimenB commented Aug 30, 2022

Thanks!

@SimenB SimenB added this to the Jest 30 milestone Aug 30, 2022
@mrazauskas
Copy link
Contributor

Perhaps it would make sense to refactor matcher usage in tests already now? I mean, like here: https://github.com/facebook/jest/blob/835a93666a69202de2a0429cd5445cb5f56d2cea/packages/jest-reporters/src/__tests__/GitHubActionsReporter.test.ts#L84

.toHaveBeenCalledTimes() matcher works already now. Why not to use ESLint rule and to clean this up. I think that it will be very hard to maintain this PR, because one more .toBeCalledTimes() could land with just another PR. Having the ESLint rule turned on, one could prevent this.

This PR could simply remove the actual implementation. The rest could be split to a separate PR and land already now. Or?

@legobeat
Copy link

legobeat commented May 1, 2023

Needs rebase on main.

@G-Rath
Copy link
Contributor

G-Rath commented Oct 20, 2023

@SimenB since you're landing breaking changes, should we get this one landed? I'm happy to do a new PR if needed

@SimenB
Copy link
Member

SimenB commented Oct 20, 2023

Yeah, let's do it!

Copy link

github-actions bot commented Dec 1, 2023

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 Dec 1, 2023
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.

[Feature]: remove alised matchers
6 participants