Uh oh!
There was an error while loading. Please reload this page.
assert: respect assert.doesNotThrow message. - #2407
Conversation
brendanashworth
commented
Aug 26, 2015
Would you mind fixing up the docs for
|
diversario
commented
Aug 26, 2015
Good point, I'll update them. |
jasnell
commented
Nov 16, 2015
@diversario ... is this still something you'd like to pursue? |
diversario
commented
Nov 16, 2015
I would; I actually asked a question here about it because I'm not quite sure how to proceed. |
jasnell
commented
Nov 16, 2015
@nodejs/ctc ... any thoughts on this one? |
cjihrig
commented
Nov 16, 2015
I thought |
jasnell
commented
Nov 16, 2015
@cjihrig good point... does that only include API changes or also behavioral fixes like this one? |
cjihrig
commented
Nov 16, 2015
I would have to go back and look at the CTC meeting notes, but I thought the idea was to only take patches that were relevant to Node's tests. |
mscdex
commented
Nov 16, 2015
I thought we would still accept actual bug fixes just not new features? |
cjihrig
commented
Nov 16, 2015
I'm cool with fixing actual bugs. |
There was a problem hiding this comment.
I'd prefer to see a more liberal use of parens to make it explicit what the evaluation order is that you're using here, mixing && and || without parens makes this very difficult to parse. The number of conditions in here adds to that difficulty and it'd be nice to reduce it with some compacting variables—although not essential, just would be nice to make this less terse.
There was a problem hiding this comment.
Breaking out the || part into a var sounds good.
rvagg
commented
Nov 17, 2015
I'm fine with fixing bugs like this |
jasnell
commented
Apr 2, 2016
@diversario ... still interested in this? |
diversario
commented
Apr 2, 2016
Oof... Is this still relevant? It's been so long. If it's still OK to go to master and there's no further PR feedback I can make the change @rvagg suggested and push up. |
jasnell
commented
Apr 4, 2016
@diversario ... yeah, still relevant. Just needs updated per @rvagg's comments and a couple of review sign offs. |
diversario
commented
Apr 10, 2016
Pushed an update. |
There was a problem hiding this comment.
Can you line wrap these so each line is <= 80
jasnell
commented
Apr 11, 2016
Generally LGTM with a few nits |
diversario
commented
Apr 13, 2016
Thanks for the feedback! I tried the ES6 syntax but I get a syntax error; I think this branch is off an old master that didn't have support for that yet. |
jasnell
commented
Apr 15, 2016
Can you rebase and update? |
Addresses nodejs#2385. Special handling to detect when user has supplied a custom message. Added a test for user message. When testing if `actual` value is an error use `util.isError` instead of `instanceof`.
Addresses nodejs#2407. Break out conditional into named variables for readability. Explain the purpose of `message` in throws/doesNotThrow assertions.
jasnell
commented
Apr 18, 2016
Landed in c1d82ac |
MylesBorins
commented
Apr 21, 2016
@jasnell lts? |
jasnell
commented
Apr 21, 2016
Yes
|
Special handling to detect when user has supplied a custom message. Added a test for user message. When testing if `actual` value is an error use `util.isError` instead of `instanceof`. Fixes: nodejs#2385 PR-URL: nodejs#2407 Reviewed-By: James M Snell <jasnell@gmail.com>
| } | ||
| if (!shouldThrow && expectedException(actual, expected)) { | ||
| const userProvidedMessage = typeof message === 'string'; |
There was a problem hiding this comment.
A year late to the party here but won't this always evaluate to true since message is forced into a string 7 lines up (line 326)?
ping @diversario, @jasnell
There was a problem hiding this comment.
Just because I stumbled upon this comment right now: this is fixed in newer versions.
Addresses #2385.
Special handling to detect when user has supplied a custom message.
Added a test for user message.
When testing if
actualvalue is an error useutil.isErrorinstead ofinstanceof.