Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
test: updated error message for messages count#15979
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
test: updated error message for messages count #15979
Uh oh!
There was an error while loading. Please reload this page.
Conversation
| assert.strictEqual(count,messages.length, | ||
| 'A worker received an invalid multicast message'); | ||
| `A worker received an invalid multicast message: | ||
| Recieved ${messages.length}, should be ${count}`); |
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.
Recieved -> Received
BridgeAROct 7, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
Using multiline template strings is actually discouraged. This would add lots of extra whitespace to the error message. Please use this instead
'A worker received an invalid multicast message'+`Received ${messages.length}, should be ${count}`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.
Thank you! I didn't know about that, we do try to keep messages very short in our code base at work so I didn't know how to handle longer strings! Will fix!
dinophile commented Oct 7, 2017
Oh dear...I get caught by that 'i before e' rule when typing all the time! Thank you for the catch! |
| assert.strictEqual(count,messages.length, | ||
| 'A worker received an invalid multicast message'); | ||
| 'A worker received an invalid multicast message'+ | ||
| `Received ${messages.length}, should be ${count}`); |
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.
If I'm not wrong it should be the opposite: Received ${count}, should be ${messages.length}.
I also think it makes sense to remove the error message in favor of the default one.
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.
I thought count is the expected number and messages.length is the actual number recieved? I'm actually away from my computer until the 23rd (on vacation!) So I can't take a look until then! But I agree taking out the error message would be a good idea!
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.
No, it is actually the other way around.
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.
Even if reversed the message is still misleading as the assertion is actually run when all messages are received by all workers, so my suggestion is to get rid of the message argument completely and use the default error message.
assert.strictEqual(count,messages.length);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.
See #15998 (comment). It's the same here.
Trott commented Oct 27, 2017
I went and fixed the nit from @lpinca. I think this is ready to go. PTAL. |
joyeecheung commented Oct 27, 2017
tniessen commented Oct 28, 2017
Landed in 65b8d21, thank you! 🎉 |
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: nodejs/node#15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: nodejs/node#15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: #15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
PR-URL: nodejs/node#15979 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)