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

Force message in matchers to always be a function #3972

Merged
merged 2 commits into from
Jul 6, 2017

Conversation

jseminck
Copy link
Contributor

@jseminck jseminck commented Jul 6, 2017

Summary

#3921

  • Update getMessage function
  • Found three cases in the code base where still a string was being returned, instead of a function
  • Updated the type

Checked the documentation, which already says:

provides a function with no arguments that returns an error message in case of failure.

Test plan

All tests pass.

Did not add any new test. Perhaps a test should be added for when we still pass a string ? Basically, it should throw an error: VM189:1 Uncaught TypeError: message is not a function

Additionally we could try/catch and default to No message was specified for this matcher. if a wrong type is supplied for message.

@cpojer cpojer merged commit b3d944e into jestjs:master Jul 6, 2017
@cpojer
Copy link
Member

cpojer commented Jul 6, 2017

Nice! Thank you very much for your contribution.

tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
* Force message in matchers to always be a function

* Rename variable back to message instead of messageFn
nigelzor added a commit to nigelzor/enzyme-matchers that referenced this pull request Aug 25, 2017
blainekasten pushed a commit to enzymejs/enzyme-matchers that referenced this pull request Aug 29, 2017
@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 May 13, 2021
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