MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / assertThrows

Function assertThrows

packages/native/scripts/smoke.mjs:27–39  ·  view source on GitHub ↗
(fn, pattern, msg)

Source from the content-addressed store, hash-verified

25}
26
27function assertThrows(fn, pattern, msg) {
28 let threw = false;
29 try {
30 fn();
31 } catch (err) {
32 threw = true;
33 if (pattern) {
34 const detail = err instanceof Error ? err.message : String(err);
35 assert(pattern.test(detail), `${msg}: wrong error detail: ${detail}`);
36 }
37 }
38 assert(threw, `${msg}: expected throw`);
39}
40
41function assertMetricsShape(metrics) {
42 assert(metrics && typeof metrics === "object", "engineGetMetrics must return an object");

Callers 1

smoke.mjsFile · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected