test: fix assert.throws error in test-http-parser
The third argument of `assert.throws()` is a message that is used by the AssertionError, not the message to check in the thrown error. It appears that there is an assert.throws() in test-http-parser that expects the latter behavior. Rewrite the call to check the error message. Even if this wasn't a mistake, this change results in a more robust check. PR-URL: https://github.com/nodejs/node/pull/19626 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
ffe3f9a182
commit
42d1d72a2e
@ -97,9 +97,10 @@ function expectBody(expected) {
|
||||
|
||||
parser.reinitialize(HTTPParser.REQUEST);
|
||||
|
||||
assert.throws(function() {
|
||||
parser.execute(request, 0, request.length);
|
||||
}, Error, 'hello world');
|
||||
assert.throws(
|
||||
() => { parser.execute(request, 0, request.length); },
|
||||
{ name: 'Error', message: 'hello world' }
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user