test: throw Error objects instead of literals
test-tls-econnreset and test-http-response-status-message throw literals instead of Error objects. Use common.fail() which throws an AssertionError. PR-URL: https://github.com/nodejs/node/pull/11168 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
parent
7ba847df1c
commit
78ba4943c5
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
@ -23,7 +23,7 @@ testCases.findByPath = function(path) {
|
|||||||
return testCase.path === path;
|
return testCase.path === path;
|
||||||
});
|
});
|
||||||
if (matching.length === 0) {
|
if (matching.length === 0) {
|
||||||
throw 'failed to find test case with path ' + path;
|
common.fail(`failed to find test case with path ${path}`);
|
||||||
}
|
}
|
||||||
return matching[0];
|
return matching[0];
|
||||||
};
|
};
|
||||||
|
@ -49,8 +49,8 @@ const ca = [ cert, cacert ];
|
|||||||
let clientError = null;
|
let clientError = null;
|
||||||
let connectError = null;
|
let connectError = null;
|
||||||
|
|
||||||
const server = tls.createServer({ ca: ca, cert: cert, key: key }, (conn) => {
|
const server = tls.createServer({ ca: ca, cert: cert, key: key }, () => {
|
||||||
throw 'unreachable';
|
common.fail('should be unreachable');
|
||||||
}).on('tlsClientError', function(err, conn) {
|
}).on('tlsClientError', function(err, conn) {
|
||||||
assert(!clientError && conn);
|
assert(!clientError && conn);
|
||||||
clientError = err;
|
clientError = err;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user