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

Improve error capturing #22

Closed
logicalparadox opened this issue Feb 25, 2012 · 5 comments
Closed

Improve error capturing #22

logicalparadox opened this issue Feb 25, 2012 · 5 comments

Comments

@logicalparadox
Copy link
Member

  • Pass actual and expected values upon construction of AssertionError so that testing libraries that check for this can report on it.
  • Make assert custom errors more useful.
@andrewcooke
Copy link

also, the message. or maybe i am misunderstanding how to use the library? when i have

chai.assert.ok(null, 'some useful error message')

why do i see "Expected null to be truthy" (or similar) instead of the helpful message i added?

@logicalparadox
Copy link
Member Author

What test library are you use?

@andrewcooke
Copy link

me? i am actually using chai within code (to catch bugs), not a test framework. the message above was what was shown in the javascript console in chrome.

(it's not a big deal, after lunch i was about to write my own assertion library instead...)

@logicalparadox
Copy link
Member Author

Interesting, certainly not an expected use case (outside of a test framework). Anyway, here is an explanation in case you were wondering: Because of the other interfaces, the AssertionError.message are auto generated. Your custom messages are available at thrownError.summary() if you are try/catching your errors.

Making those custom errors for assert style more useful is within the scope of this ticket.

logicalparadox added a commit that referenced this issue Mar 2, 2012
@logicalparadox
Copy link
Member Author

actual / expected support in a6447e8

will be in 0.5.0 release

vesln added a commit that referenced this issue Mar 7, 2012
* master:
  don't switch act/exp
  Update the compiled verison.
  Add `assert.operator`.
  Notes on messages. #22
  browser build
  have been test
  below tests
  browser build
  remove unnecessary fail export
  full support for actual/expected where relevant
  Assertion.assert support expected value
  clean up error
koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
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

No branches or pull requests

2 participants