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

Function testAsync

example/tests/gm_api_async_test.js:44–56  ·  view source on GitHub ↗
(name, fn)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected