import { type ConstructorOptions, type DOMWindow, JSDOM } from "jsdom"; import { type Types as ContextRequire } from "context-require"; export interface Browser extends JSDOM { require: ContextRequire.RequireFunction; window: DOMWindow & typeof globalThis; yield(): Promise; act(fn?: () => T): Promise>; } export interface Options extends Omit { /** The directory from which to resolve requires for this module. */ dir: string; /** The initial html to parse with jsdom. */ html?: string; /** An object containing any browser specific require hooks to be used in this module. */ extensions?: ContextRequire.Hooks; /** A function called with the window, and the module, before parsing html. */ beforeParse?(window: DOMWindow, browser: Browser): void; } /** * Creates a custom Module object which runs all required scripts * in a new jsdom instance. */ export declare function createBrowser({ dir, html, extensions, beforeParse, ...jsdomOptions }: Options): Browser;