diff options
author | Myles Borins <mborins@us.ibm.com> | 2015-10-20 11:40:54 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2015-10-24 14:42:41 -0700 |
commit | 28e9a022df3ef89a0ea21e4ad86655eb408a8d96 (patch) | |
tree | cfa007439af61736767bab8df5556c871d091468 /test/parallel/test-cluster-eaddrinuse.js | |
parent | b6207906c452be4c5f049a098fc645fdfb897306 (diff) | |
download | android-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.gz android-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.bz2 android-node-v8-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.zip |
test: wrap assert.fail when passed to callback
Currently there are many instances where assert.fail is directly passed
to a callback for error handling. Unfortunately this will swallow the
error as it is the third argument of assert.fail that sets the message
not the first.
This commit adds a new function to test/common.js that simply wraps
assert.fail and calls it with the provided message.
Tip of the hat to @trott for pointing me in the direction of this.
PR-URL: https://github.com/nodejs/node/pull/3453
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-cluster-eaddrinuse.js')
-rw-r--r-- | test/parallel/test-cluster-eaddrinuse.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-cluster-eaddrinuse.js b/test/parallel/test-cluster-eaddrinuse.js index 509dbb664e..6ff68252d9 100644 --- a/test/parallel/test-cluster-eaddrinuse.js +++ b/test/parallel/test-cluster-eaddrinuse.js @@ -12,7 +12,7 @@ var net = require('net'); var id = '' + process.argv[2]; if (id === 'undefined') { - var server = net.createServer(assert.fail); + var server = net.createServer(common.fail); server.listen(common.PORT, function() { var worker = fork(__filename, ['worker']); worker.on('message', function(msg) { @@ -24,14 +24,14 @@ if (id === 'undefined') { }); } else if (id === 'worker') { - var server = net.createServer(assert.fail); - server.listen(common.PORT, assert.fail); + var server = net.createServer(common.fail); + server.listen(common.PORT, common.fail); server.on('error', common.mustCall(function(e) { assert(e.code, 'EADDRINUSE'); process.send('stop-listening'); process.once('message', function(msg) { if (msg !== 'stopped-listening') return; - server = net.createServer(assert.fail); + server = net.createServer(common.fail); server.listen(common.PORT, common.mustCall(function() { server.close(); })); |