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

Function assert_throws_if

test/fixtures/wpt/wasm/jsapi/js-string/basic.any.js:164–175  ·  view source on GitHub ↗
(func, shouldThrow, constructor)

Source from the content-addressed store, hash-verified

162}
163
164function assert_throws_if(func, shouldThrow, constructor) {
165 let error = null;
166 try {
167 func();
168 } catch (e) {
169 error = e;
170 }
171 assert_equals(error !== null, shouldThrow, "shouldThrow mismatch");
172 if (shouldThrow && error !== null) {
173 assert_true(error instanceof constructor);
174 }
175}
176
177// Constant values used in the tests below
178const testStrings = [

Callers 1

basic.any.jsFile · 0.85

Calls 3

funcFunction · 0.50
assert_equalsFunction · 0.50
assert_trueFunction · 0.50

Tested by

no test coverage detected