-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: more useful assert messaging for child-process-execSync #15972
test: more useful assert messaging for child-process-execSync #15972
Conversation
@@ -74,11 +75,11 @@ cmd = `"${process.execPath}" -e "console.log('${msg}');"`; | |||
ret = execSync(cmd); | |||
|
|||
assert.strictEqual(ret.length, msgBuf.length); | |||
assert.deepStrictEqual(ret, msgBuf, 'execSync result buffer should match'); | |||
assert.deepStrictEqual(ret, msgBuf); |
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.
The returned error message is not going to be great here and therefore it might be better to use a error message that includes both buffers. But this should not be blocking.
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.
@BridgeAR When I run assert.deepStrictEqual in the default behavior using foobar (as in the test) and foobaz the default assertion thrown is this:
AssertionError: <Buffer 66 6f 6f 62 61 7a 0a> deepStrictEqual <Buffer 66 6f 6f 62 61 72 0a>
Are you saying that I should change it to look something like the following?:
AssertionError: ret <Buffer 66 6f 6f 62 61 7a 0a> and msgBuf <Buffer 66 6f 6f 62 61 72 0a> should be equal
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.
Na, just ignore my comment ;-)
PR-URL: nodejs#15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Landed in 55bb9c4 Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 ! |
PR-URL: #15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: nodejs/node#15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #15972 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This is a commit for Node Interactive. I changed some basic assertion messages to hopefully provide better insights into errors.
Checklist
make -j4 test
(UNIX)Affected core subsystem(s)
tests