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

Function runTestScript

e2e/utils.ts:40–52  ·  view source on GitHub ↗
(
  context: BrowserContext,
  extensionId: string,
  scriptFile: string,
  targetUrl: string,
  timeoutMs: number,
  options?: { patchCode?: (code: string) => string }
)

Source from the content-addressed store, hash-verified

38
39/** Run a test script from example/tests/ on the target page and collect console results */
40export async function runTestScript(
41 context: BrowserContext,
42 extensionId: string,
43 scriptFile: string,
44 targetUrl: string,
45 timeoutMs: number,
46 options?: { patchCode?: (code: string) => string }
47): Promise<{ passed: number; failed: number; logs: string[] }> {
48 let code = fs.readFileSync(path.join(__dirname, `../example/tests/${scriptFile}`), "utf-8");
49 code = patchScriptCode(code);
50 code = options?.patchCode ? options.patchCode(code) : code;
51 return runInlineTestScript(context, extensionId, code, targetUrl, timeoutMs);
52}
53
54/** Run inline script code on the target page and collect console results */
55export async function runInlineTestScript(

Callers

nothing calls this directly

Calls 2

runInlineTestScriptFunction · 0.85
patchScriptCodeFunction · 0.70

Tested by

no test coverage detected