Skip to content

Commit 676e618

Browse files
committed
test: apply correct assert.fail() arguments
The assert.fail function signature has the message as the third argument but, understandably, it is often assumed that it is the first argument (or at least the first argument if no other arguments are passed). This corrects the assert.fail() invocations in the Node.js tests. Before: assert.fail('message'); // result: AssertionError: 'message' undefined undefined After: assert.fail(null, null, 'message'); // result: AssertionError: message PR-URL: #3378 Reviewed-By: Colin Ihrig <[email protected]>
1 parent 0140e1b commit 676e618

13 files changed

+13
-13
lines changed

test/internet/test-dgram-send-cb-quelches-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function callbackOnly(err) {
2828
}
2929

3030
function onEvent(err) {
31-
assert.fail('Error should not be emitted if there is callback');
31+
assert.fail(null, null, 'Error should not be emitted if there is callback');
3232
}
3333

3434
function onError(err) {

test/parallel/test-fs-write-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ common.refreshTmpDir();
2424
var stream = fs.createWriteStream(file);
2525

2626
stream.on('drain', function() {
27-
assert.fail('\'drain\' event must not be emitted before ' +
27+
assert.fail(null, null, '\'drain\' event must not be emitted before ' +
2828
'stream.write() has been called at least once.');
2929
});
3030
stream.destroy();

test/parallel/test-http-header-response-splitting.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var server = http.createServer(function(req, res) {
2727
res.writeHead(200, { b: header });
2828
break;
2929
default:
30-
assert.fail('unreachable');
30+
assert.fail(null, null, 'unreachable');
3131
}
3232
res.write(responseBody);
3333
if (testIndex % 8 < 4) {

test/parallel/test-http-localaddress-bind-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
2424
method: 'GET',
2525
localAddress: invalidLocalAddress
2626
}, function(res) {
27-
assert.fail('unexpectedly got response from server');
27+
assert.fail(null, null, 'unexpectedly got response from server');
2828
}).on('error', function(e) {
2929
console.log('client got error: ' + e.message);
3030
gotError = true;

test/parallel/test-https-localaddress-bind-error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
3535
method: 'GET',
3636
localAddress: invalidLocalAddress
3737
}, function(res) {
38-
assert.fail('unexpectedly got response from server');
38+
assert.fail(null, null, 'unexpectedly got response from server');
3939
}).on('error', function(e) {
4040
console.log('client got error: ' + e.message);
4141
gotError = true;

test/parallel/test-net-connect-paused-connection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ net.createServer(function(conn) {
1111
net.connect(common.PORT, 'localhost').pause();
1212

1313
setTimeout(function() {
14-
assert.fail('expected to exit');
14+
assert.fail(null, null, 'expected to exit');
1515
}, 1000).unref();

test/parallel/test-net-write-slow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var server = net.createServer(function(socket) {
1414
socket.setNoDelay();
1515
socket.setTimeout(1000);
1616
socket.on('timeout', function() {
17-
assert.fail('flushed: ' + flushed +
17+
assert.fail(null, null, 'flushed: ' + flushed +
1818
', received: ' + received + '/' + SIZE * N);
1919
});
2020

test/parallel/test-path-parse-format.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function checkErrors(path) {
8989
return;
9090
}
9191

92-
assert.fail('should have thrown');
92+
assert.fail(null, null, 'should have thrown');
9393
});
9494
}
9595

test/parallel/test-repl-reset-event.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function testResetGlobal(cb) {
4545
}
4646

4747
var timeout = setTimeout(function() {
48-
assert.fail('Timeout, REPL did not emit reset events');
48+
assert.fail(null, null, 'Timeout, REPL did not emit reset events');
4949
}, 5000);
5050

5151
testReset(function() {

test/parallel/test-repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,5 @@ function unix_test() {
389389
unix_test();
390390

391391
timer = setTimeout(function() {
392-
assert.fail('Timeout');
392+
assert.fail(null, null, 'Timeout');
393393
}, 5000);

test/parallel/test-spawn-cmd-named-pipe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (!process.argv[2]) {
3939

4040
const comspec = process.env['comspec'];
4141
if (!comspec || comspec.length === 0) {
42-
assert.fail('Failed to get COMSPEC');
42+
assert.fail(null, null, 'Failed to get COMSPEC');
4343
}
4444

4545
const args = ['/c', process.execPath, __filename, 'child',

test/parallel/test-stream2-base64-single-char-read-end.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ src.on('end', function() {
3333
src.pipe(dst);
3434

3535
timeout = setTimeout(function() {
36-
assert.fail('timed out waiting for _write');
36+
assert.fail(null, null, 'timed out waiting for _write');
3737
}, 100);

test/parallel/test-tick-processor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function runTest(pattern, code) {
4040
return /^isolate-/.test(file);
4141
});
4242
if (matches.length != 1) {
43-
assert.fail('There should be a single log file.');
43+
assert.fail(null, null, 'There should be a single log file.');
4444
}
4545
var log = matches[0];
4646
var out = cp.execSync(process.execPath + ' ' + processor +

0 commit comments

Comments
 (0)