MCPcopy
hub / github.com/evanw/esbuild / assertEq

Function assertEq

scripts/decorator-tests.js:5326–5343  ·  view source on GitHub ↗
(callback, expected)

Source from the content-addressed store, hash-verified

5324 }
5325}
5326function assertEq(callback, expected) {
5327 let details;
5328 try {
5329 let x = callback();
5330 if (x === expected) return true;
5331 details = ` Expected: ${prettyPrint(expected)}
5332 Observed: ${prettyPrint(x)}`;
5333 } catch (error) {
5334 details = ` Throws: ${error}`;
5335 }
5336 const code = callback.toString().replace(/^\(\) => /, "").replace(/\s+/g, " ");
5337 console.log(`\u274C ${testName}
5338 Code: ${code}
5339${details}
5340`);
5341 failures++;
5342 return false;
5343}
5344function assertThrows(callback, expected) {
5345 let details;
5346 try {

Callers 15

decFunction · 0.70
decorator-tests.jsFile · 0.70
initFunction · 0.70
wrapperFunction · 0.70
Foo2Class · 0.70
Class · 0.70
classDec1Function · 0.70
classDec2Function · 0.70
methodDec1Function · 0.70
methodDec2Function · 0.70
staticMethodDec1Function · 0.70
staticMethodDec2Function · 0.70

Calls 1

prettyPrintFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…