Browse Source

test: improve assert message

Improves the message when an assertion fires in the
test-net-pipe-connect-errors so that it indicates the incorrect value
received rather than merely reporting that the value is incorrect.

PR-URL: https://github.com/nodejs/node/pull/4461
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
v4.x
Rich Trott 9 years ago
committed by Myles Borins
parent
commit
1ae0e355b9
  1. 3
      test/parallel/test-net-pipe-connect-errors.js

3
test/parallel/test-net-pipe-connect-errors.js

@ -42,7 +42,8 @@ var notSocketClient = net.createConnection(emptyTxt, function() {
}); });
notSocketClient.on('error', function(err) { notSocketClient.on('error', function(err) {
assert(err.code === 'ENOTSOCK' || err.code === 'ECONNREFUSED'); assert(err.code === 'ENOTSOCK' || err.code === 'ECONNREFUSED',
`received ${err.code} instead of ENOTSOCK or ECONNREFUSED`);
notSocketErrorFired = true; notSocketErrorFired = true;
}); });

Loading…
Cancel
Save