summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-shared-handle-bind-error.js
diff options
context:
space:
mode:
authorMyles Borins <mborins@us.ibm.com>2015-10-20 11:40:54 -0700
committerRich Trott <rtrott@gmail.com>2015-10-24 14:42:41 -0700
commit28e9a022df3ef89a0ea21e4ad86655eb408a8d96 (patch)
treecfa007439af61736767bab8df5556c871d091468 /test/parallel/test-cluster-shared-handle-bind-error.js
parentb6207906c452be4c5f049a098fc645fdfb897306 (diff)
downloadandroid-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-shared-handle-bind-error.js')
-rw-r--r--test/parallel/test-cluster-shared-handle-bind-error.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js
index a93b07ba30..288b4b443a 100644
--- a/test/parallel/test-cluster-shared-handle-bind-error.js
+++ b/test/parallel/test-cluster-shared-handle-bind-error.js
@@ -8,7 +8,7 @@ if (cluster.isMaster) {
// Master opens and binds the socket and shares it with the worker.
cluster.schedulingPolicy = cluster.SCHED_NONE;
// Hog the TCP port so that when the worker tries to bind, it'll fail.
- net.createServer(assert.fail).listen(common.PORT, function() {
+ net.createServer(common.fail).listen(common.PORT, function() {
var server = this;
var worker = cluster.fork();
worker.on('exit', common.mustCall(function(exitCode) {
@@ -18,8 +18,8 @@ if (cluster.isMaster) {
});
}
else {
- var s = net.createServer(assert.fail);
- s.listen(common.PORT, assert.fail.bind(null, 'listen should have failed'));
+ var s = net.createServer(common.fail);
+ s.listen(common.PORT, common.fail.bind(null, 'listen should have failed'));
s.on('error', common.mustCall(function(err) {
assert.equal(err.code, 'EADDRINUSE');
process.disconnect();