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

Allow messages to be functions #268

merged 1 commit into from Sep 29, 2014

Allow messages to be functions #268

merged 1 commit into from Sep 29, 2014


Copy link

@charlierudolph charlierudolph commented Jun 8, 2014

Useful for sinon-chai where the messages passed into assertions messages enumerate calls / arguments to the spy and shouldn't have to unless the assertion actually fails.
See domenic/sinon-chai#30 and domenic/sinon-chai#38

logicalparadox added a commit that referenced this pull request Sep 29, 2014
Allow messages to be functions
@logicalparadox logicalparadox merged commit 834fd5b into chaijs:master Sep 29, 2014
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
@charlierudolph charlierudolph deleted the charlierudolph:cr-lazyMessages branch Sep 29, 2014
domenic added a commit to domenic/sinon-chai that referenced this pull request Oct 5, 2014
Assertion messages are now functions instead of strings, which due to chaijs/chai#268 means they are lazily computed. This means we no longer trigger getters, e.g. the ones causing deprecation messages in #38. It also means that the actual process of calculating the assertion messages (including formatting the objects involved) only happens when the assertion fails, which fixes the slowness observed in #30.

So: fixes #30; fixes #38.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants