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

Catch unhandled AssertionErrors #1230

Closed
aaronabramov opened this issue Jul 1, 2016 · 2 comments
Closed

Catch unhandled AssertionErrors #1230

aaronabramov opened this issue Jul 1, 2016 · 2 comments
Assignees

Comments

@aaronabramov
Copy link
Contributor

right now if something throws an assertion error (e.g. assert.equal(1, 2)) we just print the error message.
AssertionError actually has a lot of info in it (actual, expected values) and we can pretty print the diff of two objects (mocha does that)

> try {assert.equal(1, 2)} catch (e) {e}
{ AssertionError: 1 == 2
  name: 'AssertionError',
  actual: 1,
  expected: 2,
  operator: '==',
  message: '1 == 2',
  generatedMessage: true }

this is especially useful for things like eslint RuleTester that uses assert and delegates its testing to global.it.

eslint/eslint#6532

@cpojer
Copy link
Member

cpojer commented Sep 29, 2016

I don't think we'll get to this anytime soon. I'm gonna close it to clean up the queue but feel free to make a PR.

@github-actions
Copy link

This issue 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 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants