MCPcopy
hub / github.com/jackwener/OpenCLI / EvalCapturePage

Class EvalCapturePage

src/browser/base-page.test.ts:879–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877
878describe('BasePage.evaluateWithArgs scoping', () => {
879 class EvalCapturePage extends BasePage {
880 scripts: string[] = [];
881 async goto(): Promise<void> {}
882 async evaluate<T = unknown>(js: string): Promise<T>;
883 async evaluate<Args extends unknown[], T>(fn: BrowserEvaluateFunction<Args, T>, ...args: Args): Promise<Awaited<T>>;
884 async evaluate(input: string | BrowserEvaluateFunction<unknown[], unknown>): Promise<unknown> {
885 const code = typeof input === 'string' ? input : input.toString();
886 this.scripts.push(code);
887 if (typeof input !== 'string') return null;
888 return globalThis.eval(input);
889 }
890 async getCookies(): Promise<[]> { return []; }
891 async screenshot(): Promise<string> { return ''; }
892 async tabs(): Promise<unknown[]> { return []; }
893 async selectTab(): Promise<void> {}
894 }
895
896 it('wraps declarations in a lexical block to avoid global const redeclaration', async () => {
897 const page = new EvalCapturePage();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected