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

Function test

example/tests/gm_api_sync_test.js:48–60  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

46
47 // 测试辅助函数
48 function test(name, fn) {
49 testResults.total++;
50 try {
51 fn();
52 testResults.passed++;
53 console.log(`%c✓ ${name}`, "color: green;");
54 return true;
55 } catch (error) {
56 testResults.failed++;
57 console.error(`%c✗ ${name}`, "color: red;", error);
58 return false;
59 }
60 }
61
62 async function testAsync(name, fn) {
63 testResults.total++;

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected