Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added template for better error explanation to assert.ok error message
  • Loading branch information
chrbergert committed Nov 6, 2017
commit 534c3ec52b224932f7ae152164e8cbaee6fa05c0
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-spawnsync-maxbuf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const args = [
{
const ret = spawnSync(process.execPath, args, { maxBuffer: 1 });

assert.ok(ret.error, 'maxBuffer should error');
assert.ok(ret.error, `instead of an error there is ${ret.error}` );

@joyeecheung joyeecheung Nov 7, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ret is returned by spawnSync, ret.error can only be either an Error or undefined, so if it fails this would always be "instead of an error there is undefined", which does not seem very helpful... I think changing the message to child process does not error when maxBuffer is set to 1 would be easier to understand.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thank you

assert.strictEqual(ret.error.errno, 'ENOBUFS');
// We can have buffers larger than maxBuffer because underneath we alloc 64k
// that matches our read sizes.
Expand Down