Skip to content

Commit

Permalink
test: improve message in net-connect-local-error
Browse files Browse the repository at this point in the history
test-net-connect-local-error can fail with messages that report
`AssertionError: undefined === 12346`. Unfortunately, this doesn't
provide sufficient information to identify what went wrong with the
test. Increase information provided.

PR-URL: #11393
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Trott authored and italoacasas committed Feb 22, 2017
1 parent 4366ab5 commit aea0d50
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/parallel/test-net-connect-local-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const client = net.connect({
});

client.on('error', common.mustCall(function onError(err) {
assert.strictEqual(err.localPort, common.PORT);
assert.strictEqual(err.localAddress, common.localhostIPv4);
assert.strictEqual(
err.localPort,
common.PORT,
`${err.localPort} !== ${common.PORT} in ${err}`
);
assert.strictEqual(
err.localAddress,
common.localhostIPv4,
`${err.localAddress} !== ${common.localhostIPv4} in ${err}`
);
}));

0 comments on commit aea0d50

Please sign in to comment.