Skip to content
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

Conversation

ericljpemberton
Copy link
Contributor

@ericljpemberton ericljpemberton commented Oct 6, 2017

This is a commit for Node Interactive. I changed some basic assertion messages to hopefully provide better insights into errors.

Checklist
Affected core subsystem(s)

tests

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Oct 6, 2017
@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Oct 6, 2017
@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 6, 2017
@@ -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);
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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 ;-)

@BridgeAR BridgeAR self-assigned this Oct 8, 2017
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Oct 8, 2017
PR-URL: nodejs#15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR
Copy link
Member

BridgeAR commented Oct 8, 2017

Landed in 55bb9c4

Thanks for the PR, and congratulations on becoming a Node.js Contributor 🎉 !

@BridgeAR BridgeAR closed this Oct 8, 2017
MylesBorins pushed a commit that referenced this pull request Oct 11, 2017
PR-URL: #15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Oct 11, 2017
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 12, 2017
PR-URL: nodejs/node#15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Oct 17, 2017
PR-URL: #15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Oct 17, 2017
MylesBorins pushed a commit that referenced this pull request Oct 18, 2017
PR-URL: #15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Oct 25, 2017
PR-URL: #15972
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants