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

Function test

example/tests/early_inject_content_test.js:22–34  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected