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

Function assert_throws_exactly_impl

test/fixtures/wpt/resources/testharness.js:2598–2614  ·  view source on GitHub ↗

* Like assert_throws_exactly but allows specifying the assertion type * (assert_throws_exactly or promise_rejects_exactly, in practice).

(exception, func, description,
                                        assertion_type)

Source from the content-addressed store, hash-verified

2596 * (assert_throws_exactly or promise_rejects_exactly, in practice).
2597 */
2598 function assert_throws_exactly_impl(exception, func, description,
2599 assertion_type)
2600 {
2601 try {
2602 func.call(this);
2603 assert(false, assertion_type, description,
2604 "${func} did not throw", {func:func});
2605 } catch (e) {
2606 if (e instanceof AssertionError) {
2607 throw e;
2608 }
2609
2610 assert(same_value(e, exception), assertion_type, description,
2611 "${func} threw ${e} but we expected it to throw ${exception}",
2612 {func:func, e:e, exception:exception});
2613 }
2614 }
2615
2616 /**
2617 * Asserts if called. Used to ensure that a specific codepath is

Callers 2

promise_rejects_exactlyFunction · 0.70
assert_throws_exactlyFunction · 0.70

Calls 3

assertFunction · 0.70
same_valueFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected