-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Introducing mocha.throwError for better async error handling #985
Conversation
👍 |
@refack thanks for reviewing this. |
Introducing mocha.throwError for better async error handling * jpbochi/async-error-handling: introduced mocha.throwError for better async error handling
@travisjeffery Nice! I'll start working on an PR for chai right away. |
if ('uncaughtException' == e) { | ||
global.onerror = function() {}; | ||
|
||
var indexOfFn = uncaughtExceptionHandlers.indexOf(fn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
way too verbose haha var i =
would do :p
if ('uncaughtException' == e) { | ||
global.onerror = function() {}; | ||
|
||
var indexOfFn = uncaughtExceptionHandlers.indexOf(fn); | ||
if (indexOfFn != -1) { uncaughtExceptionHandlers.splice(indexOfFn, 1); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename indexOfFn
here, too? (I know this file is actually generated from the other)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah, this is the one i fixed. the other one in mocha.js is the generated one. don't bother with that one.
@travisjeffery @visionmedia I just create this PR (chaijs/chai#222) for chai to use |
Has this made it into should.js yet? |
@christophercliff nope. I made a PR to chai. I should probably have created one for should.js first, sinc it's maintained by the same folks. I'll see if I create one this weekend. |
actually now that im reading this again it doesn't quite make sense, it's only supported in the browser, and they're not uncaught, they're just assertion errors so those var names are a little wonky |
@christophercliff There's one complication to implement that on @visionmedia I'm figuring out a way to run all (or at least some) |
|
This
mocha.throwError
is supposed to be called by assertion libraries.It will allows awesome diffs (like this) to be shown even when running async tests is a browser like phantomjs.
It's an alternative to #278 and #942
I plan to send a PR to chai, with a mirroring change.