mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
test: replace assert.throws with expectsError
PR-URL: https://github.com/nodejs/node/pull/17997 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
bcb01de515
commit
7969811a88
4 changed files with 19 additions and 19 deletions
|
@ -8,14 +8,13 @@ const MAX_REQUESTS = 13;
|
|||
let reqNum = 0;
|
||||
|
||||
function test(res, header, code) {
|
||||
const errRegExp = common.expectsError({
|
||||
common.expectsError(() => {
|
||||
res.writeHead(header);
|
||||
}, {
|
||||
code: 'ERR_HTTP_INVALID_STATUS_CODE',
|
||||
type: RangeError,
|
||||
message: `Invalid status code: ${code}`
|
||||
});
|
||||
assert.throws(() => {
|
||||
res.writeHead(header);
|
||||
}, errRegExp);
|
||||
}
|
||||
|
||||
const server = http.Server(common.mustCall(function(req, res) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue