interface ScriptOptions

Everything run accepts beyond the file itself — the subset of a script run a caller can set.

watch is deliberately absent. A watching script never finishes, so it cannot be a Task that resolves; it needs a session object of its own, the way WatchSession serves the test verb. Until that exists, asking for it here would return a promise that never settles.

const options: ScriptOptions = { browser: 'firefox', timeout: 30_000 };
options.browser; // 'firefox'

Properties

optional
cwd: string

Directory the file, its relative imports and node_modules lookups resolve against.

optional
browser: "chromium" | "firefox" | "webkit"

Browser engine. Defaults to chromium.

optional
port: number

Port the local server binds. Defaults to 1234, stepping over a taken one.

optional
timeout: number

Ms the script may run before it is declared hung. Unbounded by default, like deno run.

optional
open: boolean

Run in a visible browser window instead of headless.

optional
console: Console

Where the script's own output goes, exactly as test and watch take one. Defaults to this process's stdout and stderr.

It is a tee, not a switch: ScriptResult.browserLogs carries the same lines either way, so silentConsole captures the output rather than discarding it.

Usage

import { type ScriptOptions } from "lib/api/run.ts";