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

Function testAsync

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

Source from the content-addressed store, hash-verified

60 }
61
62 async function testAsync(name, fn) {
63 testResults.total++;
64 try {
65 await fn();
66 testResults.passed++;
67 console.log(`%c✓ ${name}`, "color: green;");
68 return true;
69 } catch (error) {
70 testResults.failed++;
71 console.error(`%c✗ ${name}`, "color: red;", error);
72 return false;
73 }
74 }
75
76 // assert(expected, actual, message) - 比较两个值是否相等
77 function assert(expected, actual, message) {

Callers 1

Calls 2

logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected