MCPcopy Create free account
hub / github.com/nodejs/node / assert_throws

Function assert_throws

deps/v8/test/wasm-js/testharness-additions.js:5–16  ·  view source on GitHub ↗
(code, func, description)

Source from the content-addressed store, hash-verified

3// found in the LICENSE file.
4
5function assert_throws(code, func, description) {
6 try {
7 func();
8 } catch (e) {
9 assert_true(
10 e.name === code.name,
11 'expected exception ' + code.name + ', got ' + e.name);
12 return;
13 }
14 assert_true(
15 false, 'expected exception ' + code.name + ', no exception thrown');
16}
17
18function promise_rejects(test, expected, promise, description) {
19 return promise

Callers 1

promise_rejectsFunction · 0.85

Calls 2

funcFunction · 0.50
assert_trueFunction · 0.50

Tested by

no test coverage detected