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

Function test

example/tests/early_inject_page_test.js:21–33  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

19
20// 测试辅助函数(支持同步和异步)
21async function test(name, fn) {
22 testResults.total++;
23 try {
24 await fn();
25 testResults.passed++;
26 console.log(`%c✓ ${name}`, "color: green;");
27 return true;
28 } catch (error) {
29 testResults.failed++;
30 console.error(`%c✗ ${name}`, "color: red;", error);
31 return false;
32 }
33}
34
35function testSync(name, fn) {
36 testResults.total++;

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected