test: improve assert message
authorRich Trott <rtrott@gmail.com>
Tue, 29 Dec 2015 05:28:36 +0000 (21:28 -0800)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:34 +0000 (11:52 -0800)
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>
test/parallel/test-net-pipe-connect-errors.js

index 81ad90e..dbc7967 100644 (file)
@@ -42,7 +42,8 @@ var notSocketClient = net.createConnection(emptyTxt, function() {
 });
 
 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;
 });