MCPcopy
hub / github.com/sindresorhus/is / assertThrowsTypeErrorWithMessage

Function assertThrowsTypeErrorWithMessage

test/test.ts:2354–2361  ·  view source on GitHub ↗
(assertion: () => void)

Source from the content-addressed store, hash-verified

2352 const message = 'Custom error message';
2353
2354 const assertThrowsTypeErrorWithMessage = (assertion: () => void) => {
2355 // `node:assert` does not verify the error class when matching only on `{message}`.
2356 assert.throws(assertion, error => {
2357 assert.ok(error instanceof TypeError);
2358 assert.strictEqual(error.message, message);
2359 return true;
2360 });
2361 };
2362
2363 assertThrowsTypeErrorWithMessage(() => {
2364 isAssert.array(undefined, undefined, message);

Callers 1

test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected