run(entry: string,settings?: ScriptSettings): Promise<ScriptOutcome>
Runs a script file in a real browser: bundles it with esbuild, serves it from a localhost
origin, evaluates it as a module in the page, and streams its console output to this
terminal. Resolves once the script's top level — including any top-level await — settles.
The browser is the whole point. Running the file in Node would be node, which qunitx adds
nothing to; running it in Chrome gives it a DOM, fetch against a real origin, and the same
TypeScript/JSX bundling the test runner uses.
import * as Script from './run.ts'; import type { ScriptConfig } from './run.ts'; // Defined, not invoked: launches a real browser and binds a real port. async function seed() { const outcome = await Script.run('seed.ts', { browser: 'firefox' }); return outcome.exitCode; // 0, or whatever the script assigned to globalThis.exitCode }
optional
settings: ScriptSettings
Promise<ScriptOutcome>