assert: put info in err.message, not err.name #5293
Conversation
Thank you for contributing this pull request! Here are a few pointers to make sure your submission will be considered for inclusion. The following commiters were not found in the CLA:
Please see CONTRIBUTING.md for more information |
@hackedy Did you sign the cla already? If not, can you go fill this out and click the button that makes the lawyer types happy? http://nodejs.org/cla.html |
I'm 17. Can I legally sign it? 😕 |
Also, it'd be nice if this had a new test. Just add something that catches an assertion error and verifies that the first line of the stack is correct for Otherwise, LGTM, and seems to do the right thing. |
I'm not sure, I'm not a lawyer. Maybe have your legal guardian sign it for you, and then sign it yourself next year? (Great to see people getting started with open source so young, though, that's fantastic! Keep it up!) |
got my dad to sign it, put an explanation in the "corporate contributions" box \o/ |
+1 for this btw. I bumped into this bug yesterday. |
Tests added. |
+9001 |
4716dc6 made assert.equal() and related functions work better by generating a better toString() from the expected, actual, and operator values passed to fail(). Unfortunately, this was accomplished by putting the generated message into the error's `name` property. When you passed in a custom error message, the error would put the custom error into `name` *and* `message`, resulting in helpful string representations like "AssertionError: Oh no: Oh no". This commit resolves that issue by storing the generated message in the `message` property while leaving the error's name alone and adding a regression test so that this doesn't pop back up later. Closes #5292.
rebased and merge-able @isaacs @bnoordhuis |
Landed (in v0.10) on 6101eb1. Thanks! |
🎉 |
💃 go go go @hackedy |
Original commit: d7b81b5 Float v8 patch, which has been committed to v8 master and backported to 4.8 and 4.9 in google repos, onto 4.8 v8 in deps to resolve nodejs#5089 Original title/commit from google repos for 4.8 is: PPC: [turbofan] Support for CPU models lacking isel. v8/v8@2e4da65 PR-URL: nodejs#5293 Fixes: nodejs#5089 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu>
(fixes #5292)
4716dc6 made assert.equal() and related functions work better by generating a better toString() from the expected, actual, and operator values passed to fail(). Unfortunately, this was accomplished by putting the generated message into the error's
name
property. When you passed in a custom error message, the error would put the custom error intoname
andmessage
, resulting in helpful string representations like"AssertionError: Oh no: Oh no"
.This commit resolves that issue by storing the generated message in the
message
property and leaving the error's name alone.