Functions

f
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.

f
setup(
argv?: string[],
cwd?: string
): Task<ScriptInvocation, ScriptConfigFailure>

Reads qunitx run's argv into a target and its settings.

f
suiteHint(
cwd: string,
entry: string,
relativeTo?: (
from: string,
to: string
) => string
): string

The qunitx <file> line the suite warning suggests, with forward slashes.

f
watchDirectoriesFrom(
inputs: string[],
cwd: string,
pathApi?: Pick<path, "resolve" | "dirname">
): string[]

The directories watch mode should watch, from esbuild's metafile input keys.

f
watchLoop(
directories: string[],
run: () => Promise<void>,
watch?: (
directory: string,
listener: () => void
) => void
,
debounceMs?: number
): Promise<never>

Runs run once, then again on every change to a first-party file in the bundle. Never resolves — watch mode ends when the process is signalled — except to REJECT if the very first run throws, which is a script that never started rather than a bad edit to recover from.

Interfaces

I
ScriptConfig

Everything one qunitx run invocation needs. Its own type rather than the test runner's Config: a script has no test files, no filter, no reporter and no output directory, and threading a script mode through those would make every one of them mean two things.

I
ScriptInvocation

What qunitx run's argv amounts to: the one target, and the settings the flags asked for.

I
ScriptOutcome

What one execution of the script produced.

I
ScriptSettings

Everything a caller may set on a script run: the CLI's flags and the API's options, minus argv.

Type Aliases

Variables

v
ScriptBuildFailed: Failure.FailureFactory<"ScriptBuildFailed", { entry: string; }>

The script could not be bundled — a syntax error, or an import that does not resolve.

v
ScriptNotFound: Failure.FailureFactory<"ScriptNotFound", { entry: string; }>

qunitx run was pointed at a file that is not there.