Runs ONE file as a plain script in a real browser — the API twin of qunitx run <file>, and the
sibling of test, which runs a suite.
Everything run accepts beyond the file itself — the subset of a script run a caller can set.
-
browser: "chromium" | "firefox" | "webkit"
Browser engine. Defaults to
chromium. -
console: Console
Where the script's own output goes, exactly as test and watch take one. Defaults to this process's stdout and stderr.
-
cwd: string
Directory the file, its relative imports and
node_moduleslookups resolve against. -
open: boolean
Run in a visible browser window instead of headless.
-
port: number
Port the local server binds. Defaults to 1234, stepping over a taken one.
-
timeout: number
Ms the script may run before it is declared hung. Unbounded by default, like
deno run.
What one script run produced.
-
browserLogs: BrowserLog[]
Everything the script printed — its
consolecalls and any uncaught error — in emit order, whateverconsoleoption was passed. The same shape a test run reports, capped the same way. -
browserLogsDropped: number
How many lines were dropped to stay under the cap.
0when nothing was. -
durationMs: number
Wall-clock ms from the first bundle to the script's top level settling.
-
exitCode: number
globalThis.exitCodeif the script set one, 1 if it threw, else 0. -
file: string
Absolute path of the file that ran.
-
ok: boolean
True when the script finished with exit code 0.
-
tests: RunResult | null
The suite the file declared, or
nullwhen it was a plain script. -
value: unknown
The script's
export default, orundefinedwhen it has none. -
valueProblem: string | null
Why ScriptResult.value is
undefinedeven though the script exported something, ornullwhen there is nothing to explain — including when it exported nothing at all.
| ScriptEntryFailure
Every way run can reject. A script that merely exits non-zero is NOT one of them.
run was handed something that is not one script file.
Usage
import * as mod from "lib/api/run.ts";