summaryrefslogtreecommitdiff
path: root/test/parallel
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
parentb6207906c452be4c5f049a098fc645fdfb897306 (diff)
downloadnode-new-28e9a022df3ef89a0ea21e4ad86655eb408a8d96.tar.gz
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')
-rw-r--r--test/parallel/test-child-process-recv-handle.js2
-rw-r--r--test/parallel/test-child-process-spawn-typeerror.js2
-rw-r--r--test/parallel/test-cluster-bind-privileged-port.js4
-rw-r--r--test/parallel/test-cluster-bind-twice.js6
-rw-r--r--test/parallel/test-cluster-eaddrinuse.js8
-rw-r--r--test/parallel/test-cluster-net-listen.js2
-rw-r--r--test/parallel/test-cluster-rr-ref.js2
-rw-r--r--test/parallel/test-cluster-setup-master-argv.js2
-rw-r--r--test/parallel/test-cluster-shared-handle-bind-error.js6
-rw-r--r--test/parallel/test-cluster-shared-handle-bind-privileged-port.js4
-rw-r--r--test/parallel/test-crypto-pbkdf2.js8
-rw-r--r--test/parallel/test-dgram-error-message-address.js4
-rw-r--r--test/parallel/test-dgram-oob-buffer.js12
-rw-r--r--test/parallel/test-event-emitter-remove-listeners.js2
-rw-r--r--test/parallel/test-fs-null-bytes.js6
-rw-r--r--test/parallel/test-fs-read-stream-err.js2
-rw-r--r--test/parallel/test-http-client-unescaped-path.js2
-rw-r--r--test/parallel/test-http-set-trailers.js2
-rw-r--r--test/parallel/test-https-timeout-server-2.js2
-rw-r--r--test/parallel/test-https-timeout-server.js2
-rw-r--r--test/parallel/test-listen-fd-ebadf.js4
-rw-r--r--test/parallel/test-net-better-error-messages-listen-path.js4
-rw-r--r--test/parallel/test-net-better-error-messages-listen.js4
-rw-r--r--test/parallel/test-net-better-error-messages-path.js2
-rw-r--r--test/parallel/test-net-better-error-messages-port-hostname.js2
-rw-r--r--test/parallel/test-net-better-error-messages-port.js2
-rw-r--r--test/parallel/test-net-dns-lookup-skip.js2
-rw-r--r--test/parallel/test-net-listen-fd0.js2
-rw-r--r--test/parallel/test-promises-unhandled-rejections.js28
-rw-r--r--test/parallel/test-timers-unref-remove-other-unref-timers.js2
-rw-r--r--test/parallel/test-tls-cipher-list.js4
-rw-r--r--test/parallel/test-tls-no-sslv3.js2
-rw-r--r--test/parallel/test-tls-timeout-server.js2
-rw-r--r--test/parallel/test-vm-debug-context.js8
34 files changed, 74 insertions, 74 deletions
diff --git a/test/parallel/test-child-process-recv-handle.js b/test/parallel/test-child-process-recv-handle.js
index b992445f18..5c16c7a1c6 100644
--- a/test/parallel/test-child-process-recv-handle.js
+++ b/test/parallel/test-child-process-recv-handle.js
@@ -24,7 +24,7 @@ function master() {
});
proc.stdout.on('data', function(data) {
assert.equal(data, 'ok\r\n');
- net.createServer(assert.fail).listen(common.PORT, function() {
+ net.createServer(common.fail).listen(common.PORT, function() {
handle = this._handle;
proc.send('one');
proc.send('two', handle);
diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js
index 44d67e8608..46216b63d5 100644
--- a/test/parallel/test-child-process-spawn-typeerror.js
+++ b/test/parallel/test-child-process-spawn-typeerror.js
@@ -13,7 +13,7 @@ const empty = common.fixturesDir + '/empty.js';
assert.throws(function() {
var child = spawn(invalidcmd, 'this is not an array');
- child.on('error', assert.fail);
+ child.on('error', common.fail);
}, TypeError);
// verify that valid argument combinations do not throw
diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js
index d173762575..56449eaaf2 100644
--- a/test/parallel/test-cluster-bind-privileged-port.js
+++ b/test/parallel/test-cluster-bind-privileged-port.js
@@ -20,8 +20,8 @@ if (cluster.isMaster) {
}));
}
else {
- var s = net.createServer(assert.fail);
- s.listen(42, assert.fail.bind(null, 'listen should have failed'));
+ var s = net.createServer(common.fail);
+ s.listen(42, common.fail.bind(null, 'listen should have failed'));
s.on('error', common.mustCall(function(err) {
assert.equal(err.code, 'EACCES');
process.disconnect();
diff --git a/test/parallel/test-cluster-bind-twice.js b/test/parallel/test-cluster-bind-twice.js
index ec6faa83c1..b3046cd8d5 100644
--- a/test/parallel/test-cluster-bind-twice.js
+++ b/test/parallel/test-cluster-bind-twice.js
@@ -68,7 +68,7 @@ if (!id) {
else if (id === 'one') {
if (cluster.isMaster) return startWorker();
- var server = http.createServer(assert.fail).listen(common.PORT, function() {
+ var server = http.createServer(common.fail).listen(common.PORT, function() {
process.send('READY');
});
@@ -84,12 +84,12 @@ else if (id === 'two') {
assert(ok);
});
- var server = http.createServer(assert.fail);
+ var server = http.createServer(common.fail);
process.on('message', function(m) {
if (typeof m === 'object') return; // ignore system messages
if (m === 'QUIT') process.exit();
assert.equal(m, 'START');
- server.listen(common.PORT, assert.fail);
+ server.listen(common.PORT, common.fail);
server.on('error', function(e) {
assert.equal(e.code, 'EADDRINUSE');
process.send(e.code);
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();
}));
diff --git a/test/parallel/test-cluster-net-listen.js b/test/parallel/test-cluster-net-listen.js
index 741cacc758..c79d4cf1a2 100644
--- a/test/parallel/test-cluster-net-listen.js
+++ b/test/parallel/test-cluster-net-listen.js
@@ -17,5 +17,5 @@ if (cluster.isMaster) {
}
else {
// listen() without port should not trigger a libuv assert
- net.createServer(assert.fail).listen(process.exit);
+ net.createServer(common.fail).listen(process.exit);
}
diff --git a/test/parallel/test-cluster-rr-ref.js b/test/parallel/test-cluster-rr-ref.js
index 606ff708e9..474e4d69f2 100644
--- a/test/parallel/test-cluster-rr-ref.js
+++ b/test/parallel/test-cluster-rr-ref.js
@@ -10,7 +10,7 @@ if (cluster.isMaster) {
if (msg === 'done') this.kill();
});
} else {
- const server = net.createServer(assert.fail);
+ const server = net.createServer(common.fail);
server.listen(common.PORT, function() {
server.unref();
server.ref();
diff --git a/test/parallel/test-cluster-setup-master-argv.js b/test/parallel/test-cluster-setup-master-argv.js
index b406c76cbb..e111ba9ffa 100644
--- a/test/parallel/test-cluster-setup-master-argv.js
+++ b/test/parallel/test-cluster-setup-master-argv.js
@@ -3,7 +3,7 @@ var common = require('../common');
var assert = require('assert');
var cluster = require('cluster');
-setTimeout(assert.fail.bind(assert, 'setup not emitted'), 1000).unref();
+setTimeout(common.fail.bind(assert, 'setup not emitted'), 1000).unref();
cluster.on('setup', function() {
var clusterArgs = cluster.settings.args;
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();
diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js
index f524d6bda9..a02a2ef5b6 100644
--- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js
+++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js
@@ -22,8 +22,8 @@ if (cluster.isMaster) {
}));
}
else {
- var s = net.createServer(assert.fail);
- s.listen(42, assert.fail.bind(null, 'listen should have failed'));
+ var s = net.createServer(common.fail);
+ s.listen(42, common.fail.bind(null, 'listen should have failed'));
s.on('error', common.mustCall(function(err) {
assert.equal(err.code, 'EACCES');
process.disconnect();
diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js
index 51759ca835..39b98b38e2 100644
--- a/test/parallel/test-crypto-pbkdf2.js
+++ b/test/parallel/test-crypto-pbkdf2.js
@@ -62,28 +62,28 @@ assert.throws(function() {
// Should not work with Infinity key length
assert.throws(function() {
- crypto.pbkdf2('password', 'salt', 1, Infinity, assert.fail);
+ crypto.pbkdf2('password', 'salt', 1, Infinity, common.fail);
}, function(err) {
return err instanceof Error && err.message === 'Bad key length';
});
// Should not work with negative Infinity key length
assert.throws(function() {
- crypto.pbkdf2('password', 'salt', 1, -Infinity, assert.fail);
+ crypto.pbkdf2('password', 'salt', 1, -Infinity, common.fail);
}, function(err) {
return err instanceof Error && err.message === 'Bad key length';
});
// Should not work with NaN key length
assert.throws(function() {
- crypto.pbkdf2('password', 'salt', 1, NaN, assert.fail);
+ crypto.pbkdf2('password', 'salt', 1, NaN, common.fail);
}, function(err) {
return err instanceof Error && err.message === 'Bad key length';
});
// Should not work with negative key length
assert.throws(function() {
- crypto.pbkdf2('password', 'salt', 1, -1, assert.fail);
+ crypto.pbkdf2('password', 'salt', 1, -1, common.fail);
}, function(err) {
return err instanceof Error && err.message === 'Bad key length';
});
diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js
index eca2ccce4f..e307a23e24 100644
--- a/test/parallel/test-dgram-error-message-address.js
+++ b/test/parallel/test-dgram-error-message-address.js
@@ -6,7 +6,7 @@ var dgram = require('dgram');
// IPv4 Test
var socket_ipv4 = dgram.createSocket('udp4');
-socket_ipv4.on('listening', assert.fail);
+socket_ipv4.on('listening', common.fail);
socket_ipv4.on('error', common.mustCall(function(e) {
assert.equal(e.message, 'bind EADDRNOTAVAIL 1.1.1.1:' + common.PORT);
@@ -22,7 +22,7 @@ socket_ipv4.bind(common.PORT, '1.1.1.1');
var socket_ipv6 = dgram.createSocket('udp6');
var family_ipv6 = 'IPv6';
-socket_ipv6.on('listening', assert.fail);
+socket_ipv6.on('listening', common.fail);
socket_ipv6.on('error', common.mustCall(function(e) {
// EAFNOSUPPORT or EPROTONOSUPPORT means IPv6 is disabled on this system.
diff --git a/test/parallel/test-dgram-oob-buffer.js b/test/parallel/test-dgram-oob-buffer.js
index e873715e4e..6d0626fc2d 100644
--- a/test/parallel/test-dgram-oob-buffer.js
+++ b/test/parallel/test-dgram-oob-buffer.js
@@ -19,22 +19,22 @@ socket.send(buf, 3, 1, common.PORT, '127.0.0.1', ok);
socket.send(buf, 4, 0, common.PORT, '127.0.0.1', ok);
assert.throws(function() {
- socket.send(buf, 0, 5, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 0, 5, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send(buf, 2, 3, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 2, 3, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send(buf, 4, 4, common.PORT, '127.0.0.1', assert.fail);
+ socket.send(buf, 4, 4, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', 4, 1, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', 4, 1, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', 0, 4, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', 0, 4, common.PORT, '127.0.0.1', common.fail);
});
assert.throws(function() {
- socket.send('abc', -1, 2, common.PORT, '127.0.0.1', assert.fail);
+ socket.send('abc', -1, 2, common.PORT, '127.0.0.1', common.fail);
});
socket.close(); // FIXME should not be necessary
diff --git a/test/parallel/test-event-emitter-remove-listeners.js b/test/parallel/test-event-emitter-remove-listeners.js
index 409ccbebe2..8993aadf51 100644
--- a/test/parallel/test-event-emitter-remove-listeners.js
+++ b/test/parallel/test-event-emitter-remove-listeners.js
@@ -39,7 +39,7 @@ assert.deepEqual([], e1.listeners('hello'));
var e2 = new events.EventEmitter();
e2.on('hello', listener1);
-e2.on('removeListener', assert.fail);
+e2.on('removeListener', common.fail);
e2.removeListener('hello', listener2);
assert.deepEqual([listener1], e2.listeners('hello'));
diff --git a/test/parallel/test-fs-null-bytes.js b/test/parallel/test-fs-null-bytes.js
index 77228521e6..c80588486d 100644
--- a/test/parallel/test-fs-null-bytes.js
+++ b/test/parallel/test-fs-null-bytes.js
@@ -43,10 +43,10 @@ check(fs.symlink, fs.symlinkSync, 'foo\u0000bar', 'foobar');
check(fs.symlink, fs.symlinkSync, 'foobar', 'foo\u0000bar');
check(fs.truncate, fs.truncateSync, 'foo\u0000bar');
check(fs.unlink, fs.unlinkSync, 'foo\u0000bar');
-check(null, fs.unwatchFile, 'foo\u0000bar', assert.fail);
+check(null, fs.unwatchFile, 'foo\u0000bar', common.fail);
check(fs.utimes, fs.utimesSync, 'foo\u0000bar', 0, 0);
-check(null, fs.watch, 'foo\u0000bar', assert.fail);
-check(null, fs.watchFile, 'foo\u0000bar', assert.fail);
+check(null, fs.watch, 'foo\u0000bar', common.fail);
+check(null, fs.watchFile, 'foo\u0000bar', common.fail);
check(fs.writeFile, fs.writeFileSync, 'foo\u0000bar');
// an 'error' for exists means that it doesn't exist.
diff --git a/test/parallel/test-fs-read-stream-err.js b/test/parallel/test-fs-read-stream-err.js
index 1eb6aa5790..1bc2b6f0b0 100644
--- a/test/parallel/test-fs-read-stream-err.js
+++ b/test/parallel/test-fs-read-stream-err.js
@@ -39,5 +39,5 @@ fs.read = function() {
};
stream.on('data', function(buf) {
- stream.on('data', assert.fail); // no more 'data' events should follow
+ stream.on('data', common.fail); // no more 'data' events should follow
});
diff --git a/test/parallel/test-http-client-unescaped-path.js b/test/parallel/test-http-client-unescaped-path.js
index 1536916ae9..e01df255a8 100644
--- a/test/parallel/test-http-client-unescaped-path.js
+++ b/test/parallel/test-http-client-unescaped-path.js
@@ -5,5 +5,5 @@ var http = require('http');
assert.throws(function() {
// Path with spaces in it should throw.
- http.get({ path: 'bad path' }, assert.fail);
+ http.get({ path: 'bad path' }, common.fail);
}, /contains unescaped characters/);
diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js
index 6f5c02f560..f3ee5b157f 100644
--- a/test/parallel/test-http-set-trailers.js
+++ b/test/parallel/test-http-set-trailers.js
@@ -53,7 +53,7 @@ server.on('listening', function() {
c.on('connect', function() {
outstanding_reqs++;
c.write('GET / HTTP/1.1\r\n\r\n');
- tid = setTimeout(assert.fail, 2000, 'Couldn\'t find last chunk.');
+ tid = setTimeout(common.fail, 2000, 'Couldn\'t find last chunk.');
});
c.on('data', function(chunk) {
diff --git a/test/parallel/test-https-timeout-server-2.js b/test/parallel/test-https-timeout-server-2.js
index 9970688fe7..df605958cf 100644
--- a/test/parallel/test-https-timeout-server-2.js
+++ b/test/parallel/test-https-timeout-server-2.js
@@ -18,7 +18,7 @@ var options = {
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
};
-var server = https.createServer(options, assert.fail);
+var server = https.createServer(options, common.fail);
server.on('secureConnection', function(cleartext) {
var s = cleartext.setTimeout(50, function() {
diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js
index 0db7ad533d..ba175ecf76 100644
--- a/test/parallel/test-https-timeout-server.js
+++ b/test/parallel/test-https-timeout-server.js
@@ -24,7 +24,7 @@ var options = {
handshakeTimeout: 50
};
-var server = https.createServer(options, assert.fail);
+var server = https.createServer(options, common.fail);
server.on('clientError', function(err, conn) {
// Don't hesitate to update the asserts if the internal structure of
diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js
index db905dfa35..51e09a7907 100644
--- a/test/parallel/test-listen-fd-ebadf.js
+++ b/test/parallel/test-listen-fd-ebadf.js
@@ -9,8 +9,8 @@ process.on('exit', function() {
assert.equal(gotError, 2);
});
-net.createServer(assert.fail).listen({fd:2}).on('error', onError);
-net.createServer(assert.fail).listen({fd:42}).on('error', onError);
+net.createServer(common.fail).listen({fd:2}).on('error', onError);
+net.createServer(common.fail).listen({fd:42}).on('error', onError);
function onError(ex) {
assert.equal(ex.code, 'EINVAL');
diff --git a/test/parallel/test-net-better-error-messages-listen-path.js b/test/parallel/test-net-better-error-messages-listen-path.js
index 8a7e0220b3..41d22c3fb9 100644
--- a/test/parallel/test-net-better-error-messages-listen-path.js
+++ b/test/parallel/test-net-better-error-messages-listen-path.js
@@ -3,8 +3,8 @@ var common = require('../common');
var assert = require('assert');
var net = require('net');
var fp = '/blah/fadfa';
-var server = net.createServer(assert.fail);
-server.listen(fp, assert.fail);
+var server = net.createServer(common.fail);
+server.listen(fp, common.fail);
server.on('error', common.mustCall(function(e) {
assert.equal(e.address, fp);
}));
diff --git a/test/parallel/test-net-better-error-messages-listen.js b/test/parallel/test-net-better-error-messages-listen.js
index 7e5fad925a..44adce71a7 100644
--- a/test/parallel/test-net-better-error-messages-listen.js
+++ b/test/parallel/test-net-better-error-messages-listen.js
@@ -3,8 +3,8 @@ var common = require('../common');
var assert = require('assert');
var net = require('net');
-var server = net.createServer(assert.fail);
-server.listen(1, '1.1.1.1', assert.fail);
+var server = net.createServer(common.fail);
+server.listen(1, '1.1.1.1', common.fail);
server.on('error', common.mustCall(function(e) {
assert.equal(e.address, '1.1.1.1');
assert.equal(e.port, 1);
diff --git a/test/parallel/test-net-better-error-messages-path.js b/test/parallel/test-net-better-error-messages-path.js
index 06cfecbd7c..9222a1cc75 100644
--- a/test/parallel/test-net-better-error-messages-path.js
+++ b/test/parallel/test-net-better-error-messages-path.js
@@ -5,7 +5,7 @@ var assert = require('assert');
var fp = '/tmp/fadagagsdfgsdf';
var c = net.connect(fp);
-c.on('connect', assert.fail);
+c.on('connect', common.fail);
c.on('error', common.mustCall(function(e) {
assert.equal(e.code, 'ENOENT');
diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js
index bdca6c2b3c..9db6fb26f5 100644
--- a/test/parallel/test-net-better-error-messages-port-hostname.js
+++ b/test/parallel/test-net-better-error-messages-port-hostname.js
@@ -5,7 +5,7 @@ var assert = require('assert');
var c = net.createConnection(common.PORT, '...');
-c.on('connect', assert.fail);
+c.on('connect', common.fail);
c.on('error', common.mustCall(function(e) {
assert.equal(e.code, 'ENOTFOUND');
diff --git a/test/parallel/test-net-better-error-messages-port.js b/test/parallel/test-net-better-error-messages-port.js
index 0f90089c05..514e317fbb 100644
--- a/test/parallel/test-net-better-error-messages-port.js
+++ b/test/parallel/test-net-better-error-messages-port.js
@@ -5,7 +5,7 @@ var assert = require('assert');
var c = net.createConnection(common.PORT);
-c.on('connect', assert.fail);
+c.on('connect', common.fail);
c.on('error', common.mustCall(function(e) {
assert.equal(e.code, 'ECONNREFUSED');
diff --git a/test/parallel/test-net-dns-lookup-skip.js b/test/parallel/test-net-dns-lookup-skip.js
index 1083ed9fc0..b293196ad4 100644
--- a/test/parallel/test-net-dns-lookup-skip.js
+++ b/test/parallel/test-net-dns-lookup-skip.js
@@ -11,7 +11,7 @@ function check(addressType) {
var address = addressType === 4 ? '127.0.0.1' : '::1';
server.listen(common.PORT, address, function() {
- net.connect(common.PORT, address).on('lookup', assert.fail);
+ net.connect(common.PORT, address).on('lookup', common.fail);
});
}
diff --git a/test/parallel/test-net-listen-fd0.js b/test/parallel/test-net-listen-fd0.js
index e326ac2b60..1a6c4716eb 100644
--- a/test/parallel/test-net-listen-fd0.js
+++ b/test/parallel/test-net-listen-fd0.js
@@ -10,7 +10,7 @@ process.on('exit', function() {
});
// this should fail with an async EINVAL error, not throw an exception
-net.createServer(assert.fail).listen({fd:0}).on('error', function(e) {
+net.createServer(common.fail).listen({fd:0}).on('error', function(e) {
switch (e.code) {
case 'EINVAL':
case 'ENOTSOCK':
diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js
index e5b3e6f35c..e229bada3a 100644
--- a/test/parallel/test-promises-unhandled-rejections.js
+++ b/test/parallel/test-promises-unhandled-rejections.js
@@ -164,7 +164,7 @@ asyncTest('Catching a promise rejection after setImmediate is not' +
});
_reject(e);
setImmediate(function() {
- promise.then(assert.fail, function() {});
+ promise.then(common.fail, function() {});
});
});
@@ -176,7 +176,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the' +
assert.strictEqual(e2, reason);
assert.strictEqual(promise2, promise);
});
- var promise2 = Promise.reject(e).then(assert.fail, function(reason) {
+ var promise2 = Promise.reject(e).then(common.fail, function(reason) {
assert.strictEqual(e, reason);
throw e2;
});
@@ -206,7 +206,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the ' +
setTimeout(function() {
reject(e);
}, 1);
- }).then(assert.fail, function(reason) {
+ }).then(common.fail, function(reason) {
assert.strictEqual(e, reason);
throw e2;
});
@@ -225,7 +225,7 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' +
setTimeout(function() {
reject(e);
process.nextTick(function() {
- promise2 = promise.then(assert.fail, function(reason) {
+ promise2 = promise.then(common.fail, function(reason) {
assert.strictEqual(e, reason);
throw e2;
});
@@ -240,7 +240,7 @@ asyncTest('unhandledRejection should not be triggered if a promise catch is' +
function(done) {
var e = new Error();
onUnhandledFail(done);
- Promise.reject(e).then(assert.fail, function() {});
+ Promise.reject(e).then(common.fail, function() {});
});
asyncTest('unhandledRejection should not be triggered if a promise catch is' +
@@ -250,7 +250,7 @@ asyncTest('unhandledRejection should not be triggered if a promise catch is' +
onUnhandledFail(done);
new Promise(function(_, reject) {
reject(e);
- }).then(assert.fail, function() {});
+ }).then(common.fail, function() {});
});
asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
@@ -259,7 +259,7 @@ asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
onUnhandledFail(done);
var promise = Promise.reject(e);
process.nextTick(function() {
- promise.then(assert.fail, function() {});
+ promise.then(common.fail, function() {});
});
});
@@ -271,7 +271,7 @@ asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
reject(e);
});
process.nextTick(function() {
- promise.then(assert.fail, function() {});
+ promise.then(common.fail, function() {});
});
});
@@ -302,7 +302,7 @@ asyncTest('catching a promise which is asynchronously rejected (via' +
reject(e);
}, 1);
});
- }).then(assert.fail, function(reason) {
+ }).then(common.fail, function(reason) {
assert.strictEqual(e, reason);
});
});
@@ -313,7 +313,7 @@ asyncTest('Catching a rejected promise derived from throwing in a' +
onUnhandledFail(done);
Promise.resolve().then(function() {
throw e;
- }).then(assert.fail, function(reason) {
+ }).then(common.fail, function(reason) {
assert.strictEqual(e, reason);
});
});
@@ -325,7 +325,7 @@ asyncTest('Catching a rejected promise derived from returning a' +
onUnhandledFail(done);
Promise.resolve().then(function() {
return Promise.reject(e);
- }).then(assert.fail, function(reason) {
+ }).then(common.fail, function(reason) {
assert.strictEqual(e, reason);
});
});
@@ -380,7 +380,7 @@ asyncTest('Catching the Promise.all() of a collection that includes a' +
'rejected promise prevents unhandledRejection', function(done) {
var e = new Error();
onUnhandledFail(done);
- Promise.all([Promise.reject(e)]).then(assert.fail, function() {});
+ Promise.all([Promise.reject(e)]).then(common.fail, function() {});
});
asyncTest('Catching the Promise.all() of a collection that includes a ' +
@@ -395,7 +395,7 @@ asyncTest('Catching the Promise.all() of a collection that includes a ' +
});
p = Promise.all([p]);
process.nextTick(function() {
- p.then(assert.fail, function() {});
+ p.then(common.fail, function() {});
});
});
@@ -430,7 +430,7 @@ asyncTest('Waiting setTimeout(, 10) to catch a promise causes an' +
throw e;
});
setTimeout(function() {
- thePromise.then(assert.fail, function(reason) {
+ thePromise.then(common.fail, function(reason) {
assert.strictEqual(e, reason);
});
}, 10);
diff --git a/test/parallel/test-timers-unref-remove-other-unref-timers.js b/test/parallel/test-timers-unref-remove-other-unref-timers.js
index f727d5f86f..8c1864f1a7 100644
--- a/test/parallel/test-timers-unref-remove-other-unref-timers.js
+++ b/test/parallel/test-timers-unref-remove-other-unref-timers.js
@@ -11,7 +11,7 @@ const assert = require('assert');
const timers = require('timers');
const foo = {
- _onTimeout: assert.fail
+ _onTimeout: common.fail
};
const bar = {
diff --git a/test/parallel/test-tls-cipher-list.js b/test/parallel/test-tls-cipher-list.js
index 9ae8fefa0f..f20a0a6a24 100644
--- a/test/parallel/test-tls-cipher-list.js
+++ b/test/parallel/test-tls-cipher-list.js
@@ -17,12 +17,12 @@ function doCheck(arg, check) {
'require("constants").defaultCipherList'
]);
spawn(process.execPath, arg, {}).
- on('error', assert.fail).
+ on('error', common.fail).
stdout.on('data', function(chunk) {
out += chunk;
}).on('end', function() {
assert.equal(out.trim(), check);
- }).on('error', assert.fail);
+ }).on('error', common.fail);
}
// test the default unmodified version
diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js
index 9777397758..ce5a9d395d 100644
--- a/test/parallel/test-tls-no-sslv3.js
+++ b/test/parallel/test-tls-no-sslv3.js
@@ -18,7 +18,7 @@ if (common.opensslCli === false) {
var cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
var key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
-var server = tls.createServer({ cert: cert, key: key }, assert.fail);
+var server = tls.createServer({ cert: cert, key: key }, common.fail);
server.listen(common.PORT, '127.0.0.1', function() {
var address = this.address().address + ':' + this.address().port;
diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js
index ee932c9b1f..e3ed246386 100644
--- a/test/parallel/test-tls-timeout-server.js
+++ b/test/parallel/test-tls-timeout-server.js
@@ -23,7 +23,7 @@ var options = {
handshakeTimeout: 50
};
-var server = tls.createServer(options, assert.fail);
+var server = tls.createServer(options, common.fail);
server.on('clientError', function(err, conn) {
conn.destroy();
diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js
index 0f15d40ef1..2e86d136be 100644
--- a/test/parallel/test-vm-debug-context.js
+++ b/test/parallel/test-vm-debug-context.js
@@ -10,7 +10,7 @@ assert.throws(function() {
}, /SyntaxError/);
assert.throws(function() {
- vm.runInDebugContext({ toString: assert.fail });
+ vm.runInDebugContext({ toString: common.fail });
}, /AssertionError/);
assert.throws(function() {
@@ -58,7 +58,7 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined);
var script = common.fixturesDir + '/vm-run-in-debug-context.js';
var proc = spawn(process.execPath, [script]);
var data = [];
-proc.stdout.on('data', assert.fail);
+proc.stdout.on('data', common.fail);
proc.stderr.on('data', data.push.bind(data));
proc.stderr.once('end', common.mustCall(function() {
var haystack = Buffer.concat(data).toString('utf8');
@@ -70,8 +70,8 @@ proc.once('exit', common.mustCall(function(exitCode, signalCode) {
}));
var proc = spawn(process.execPath, [script, 'handle-fatal-exception']);
-proc.stdout.on('data', assert.fail);
-proc.stderr.on('data', assert.fail);
+proc.stdout.on('data', common.fail);
+proc.stderr.on('data', common.fail);
proc.once('exit', common.mustCall(function(exitCode, signalCode) {
assert.equal(exitCode, 42);
assert.equal(signalCode, null);