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
merged 1 commit into from
Sep 29, 2014
Merged

Allow messages to be functions #268

merged 1 commit into from
Sep 29, 2014

Conversation

charlierudolph
Copy link

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 chaijs/sinon-chai#30 and chaijs/sinon-chai#38

logicalparadox added a commit that referenced this pull request Sep 29, 2014
@logicalparadox logicalparadox merged commit 834fd5b into chaijs:master Sep 29, 2014
@charlierudolph charlierudolph deleted the cr-lazyMessages branch September 29, 2014 22:36
domenic added a commit to chaijs/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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants