Skip to content

Commit 806bc0d

Browse files
Trotttargos
authored andcommitted
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: #19626 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2f09ee7 commit 806bc0d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/parallel/test-http-parser.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ function expectBody(expected) {
9797

9898
parser.reinitialize(HTTPParser.REQUEST);
9999

100-
assert.throws(function() {
101-
parser.execute(request, 0, request.length);
102-
}, Error, 'hello world');
100+
assert.throws(
101+
() => { parser.execute(request, 0, request.length); },
102+
{ name: 'Error', message: 'hello world' }
103+
);
103104
}
104105

105106

0 commit comments

Comments
 (0)