MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / test

Function test

example/tests/sandbox_test.js:92–104  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

90 }
91
92 async function test(name, fn) {
93 testResults.total++;
94 try {
95 await fn();
96 testResults.passed++;
97 console.log(`%cPASS ${name}`, "color: green;");
98 return true;
99 } catch (error) {
100 testResults.failed++;
101 console.error(`%cFAIL ${name}`, "color: red;", error);
102 return false;
103 }
104 }
105
106 function section(name) {
107 console.log(`\n%c--- ${name} ---`, "color: orange; font-weight: bold;");

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected