MCPcopy Index your code
hub / github.com/coder/mux / createMockBrowserWindow

Function createMockBrowserWindow

src/node/bench/headlessEnvironment.ts:30–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28}
29
30function createMockBrowserWindow(): {
31 window: BrowserWindow;
32 sentEvents: Array<{ channel: string; data: unknown }>;
33} {
34 const sentEvents: Array<{ channel: string; data: unknown }> = [];
35
36 const mockWindow = {
37 webContents: {
38 send: (channel: string, data: unknown) => {
39 sentEvents.push({ channel, data });
40 },
41 openDevTools: () => {
42 throw new Error("openDevTools is not supported in headless mode");
43 },
44 } as unknown as WebContents,
45 isMinimized: () => false,
46 restore: () => undefined,
47 focus: () => undefined,
48 loadURL: () => {
49 throw new Error("loadURL should not be called in headless mode");
50 },
51 on: () => undefined,
52 setTitle: () => undefined,
53 } as unknown as BrowserWindow;
54
55 return { window: mockWindow, sentEvents };
56}
57
58async function establishRootDir(providedRootDir?: string): Promise<{
59 rootDir: string;

Callers 1

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected