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

Conversation

Projects
None yet
2 participants
@charlierudolph
Contributor

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

charlierudolph

logicalparadox added a commit that referenced this pull request Sep 29, 2014

Merge pull request #268 from charlierudolph/cr-lazyMessages
Allow messages to be functions

@logicalparadox logicalparadox merged commit 834fd5b into chaijs:master Sep 29, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@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

Use Chai's new lazy-message feature.
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