| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Commit messages nits (ref):
|
Sorry, something went wrong.
Sorry, something went wrong.
|
@vsemozhetbyt thank you for the feedback. I changed the commit text plus squashed two commits. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Is this semver-major? If so, beware v.8 rc deadline will be closing in 2 days. |
Sorry, something went wrong.
|
seems like test/arm tests failed... Could someone please help me to solve it? |
Sorry, something went wrong.
|
@krydos Given the nature of this change, I think we can ignore the Jenkins issue as unrelated. If someone really wants to, they can re-run CI. Labeling semver-major out of abundance of caution. |
Sorry, something went wrong.
|
The Got unwanted exception bit is still useful to explain the situation. Not entirely happy with dropping that. |
Sorry, something went wrong.
|
@jasnell what if I'll change it to Got unwanted exception (the error message)...? Probably it will be even better. EDIT: |
Sorry, something went wrong.
|
Well, I don't think just including the original error message is useful enough. The stack trace is usually more helpful, but if we use the original stack trace that may/may not be confusing with the modified exception message. Perhaps if we separated with a newline that might be clearer? For example: err.message = 'Got unwanted exception:\n' + err.message;
throw err;Doing so would mean we would need to tweak fail()/AssertionError to use the original stack trace. |
Sorry, something went wrong.
|
@mscdex excuse me, but I didn't really understand why do we need to change how fail or AssertionError work. As you and @jasnell noticed, and I agree with, that error.message without Got unwanted exception may be confusing. I also didn't understand the meaning of original stack trace just because I do not see that stack trace is getting modified somehow during doesNotThrow execution. So as for me stack trace is always original. Could you please help me to understand this? 😊 |
Sorry, something went wrong.
|
CI 3: https://ci.nodejs.org/job/node-test-commit/8845/ (all green) |
Sorry, something went wrong.
|
@krydos Nevermind, I suppose it works fine for this situation because it's synchronous. |
Sorry, something went wrong.
|
In my last commit I returned Got unwanted exception since it is something that can help to understand what just happened. I hope it's ok. EDIT: |
Sorry, something went wrong.
There was a problem hiding this comment.
The indenting is off here
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell a.doesNotThrow ignores... should be aligned with /Got unwanted exception.... Do I understand it correctly?
Sorry, something went wrong.
There was a problem hiding this comment.
...probably not since jslint throws error about it.
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell unfortunately I didn't really understand where indenting was off :( I hope it was fixed with new commit... but probably not.
Sorry, something went wrong.
There was a problem hiding this comment.
Why is it 'Got unwanted exception:\n' + actual.message + message instead of 'Got unwanted exception: ' + message + '\n' + actual.message (more similar to what it used to be)? This way it would be:
Got unwanted exception: explain why it is unwanted. Message of the unwanted exception.
Sorry, something went wrong.
There was a problem hiding this comment.
Looks really good.
But probably something like that
'Got unwanted exception' + message + '\n' + actual.message
(without : after exception) since message will have it (if message exists). Otherwise message will have just . (dot).
So, if message wasn't passed it will look like:
Got unwanted exception. Message of the unwanted exception.
I really like your idea.
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung just pushed the changes you suggested. Thank you!
Sorry, something went wrong.
There was a problem hiding this comment.
This message is no longer accurate...this test fails if a.doesNotThrow ignores user message or if it ignores the message of the unwanted exception..
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung completely agree with your here. I added another test case that tests unwanted exception message. I hope it is ok.
Sorry, something went wrong.
|
@jasnell ping. |
Sorry, something went wrong.
There was a problem hiding this comment.
I think what @jasnell mean is that the opening ' should be directly below the opening /. (Or just drop the extra third argument here, I think I would prefer that.)
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you @addaleax ... yes, that's what I meant.
(I missed the earlier ping)
Sorry, something went wrong.
There was a problem hiding this comment.
I actually tried to align ' with / but I was unable to pass linter in this case. It was saying I have wrong indentation.
Since it is ok to remove third argument this is exactly what I did.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah I've seen that happen before, it wants to align with the function call's opening (.
Sorry, something went wrong.
There was a problem hiding this comment.
Can we add a test to confirm we don't get unhelpful strings (like "undefined") if the user leaves out the optional message argument?
Sorry, something went wrong.
There was a problem hiding this comment.
Also, probably a good idea to include a test case for if a primitive is thrown rather than a proper Error. Like, maybe throw "big problem". You'll probably need to disable an eslint rule with a comment because we lint for throw being used with an unexpected type like that.
Sorry, something went wrong.
There was a problem hiding this comment.
@Trott thank you for recommendations. I've added one more test to check if no user message provided.
As for second comment about throw primitive... it really displays undefined as error text. It goes to another branch and do not entering in the if that I touched in PR. It happens probably because util.isError is returning false since string isn't good Error object.
I'm still thinking about good way to fix it...
Sorry, something went wrong.
|
Sanity of rebase: https://ci.nodejs.org/job/node-test-commit-linuxone/7173/ 🔴 |
Sorry, something went wrong.
assert.doesNotThrow() should show actual error message instead of "Got unwanted exception" which is not really helpful. PR-URL: nodejs#12167 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
There was a problem hiding this comment.
needs a 4th argument caller should be either assert.throws or assert.doesNotThrow
Sorry, something went wrong.
There was a problem hiding this comment.
IMHO the check should be using try / catch otherwise we get into a weird situation where we use the function to test itself and Alex Turing will get mad, and say 🛑
Sorry, something went wrong.
There was a problem hiding this comment.
@refack thanks for the feedback. throws calls innerThrows internally and doesNotThrow calls innerThrows internally as well. That's why we use function to test itself? Did I understand you correctly? Do we need just usual try / catch instead of assert.throws right?
Sorry, something went wrong.
|
While trying to test if I rebased this correctly I got: not ok 53 parallel/test-assert
---
duration_ms: 0.90
severity: fail
stack: |-
assert.js:544
throw actual;
^
AssertionError [ERR_ASSERTION]: Got unwanted exception: user message
[object Object]
at innerThrows (assert.js:549:7)
at Function.doesNotThrow (assert.js:566:3)
at assert.throws (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-assert.js:472:10)
at tryBlock (assert.js:514:5)
at innerThrows (assert.js:533:18)
at Function.throws (assert.js:562:3)
at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-assert.js:471:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
...Who throw the exception? The function we are testing, or the function we are using to assert the the result is as expected? 💫 |
Sorry, something went wrong.
|
I'm currently not sure why actual is [object Object] right now... It was differently before :) |
Sorry, something went wrong.
|
Ok, I also could avoid using thrower function in my tests and use my own thrower. I think it's not bad... but I tried to keep my tests similar to others. Please update me if "custom thrower" will be better in this case. p.s. |
Sorry, something went wrong.
|
I think using the current thrower is fine, we could add a comment for why it's [Object object] for clarity but since this is validated in other tests as well we don't really have to do that ¯\(ツ)/¯ +1 to @refack 's idea of using try-catch instead of throws to test doesNotThrow since we are calling innerThrows in both functions |
Sorry, something went wrong.
assert.doesNotThrow() should show actual error message instead of "Got unwanted exception" which is not really helpful.
|
@joyeecheung @refack thanks for explanation and suggestion to use try / catch instead of assert.throws to test assert.doesNotThrow. I've pushed new changes. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Quick CI just for freshness: https://ci.nodejs.org/job/node-test-commit-linuxone/7434/ |
Sorry, something went wrong.
assert.doesNotThrow() should show actual error message instead of "Got unwanted exception" which is not really helpful. PR-URL: nodejs#12167 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
|
Thanks everyone for help and feedback 🙌 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
As mentioned in #12079 doesNotThrow doesn't show actual error message but shows Got unwanted error which is not really helpful. As @mscdex said it will be better to show actual error message so this is what I have done here. parallel/test-assert.js also was changed a bit.
I hope it will be helpful.
Checklist
Affected core subsystem(s)
assert