Public options in, runner input out — this is the API's Args.parse, and the only reason
UserRunOptions and ConfigOptions are separate types.
Rejects options the run cannot honour, before anything is launched.
Everything a run can be told to do. Every field is optional: run() with no arguments runs
the project exactly as a bare qunitx would, minus the printing.
-
after: string | false
Path to a module run after the tests; it receives the run's counters.
-
before: string | false
Path to a module run before the tests; it receives the resolved config.
-
browser: "chromium" | "firefox" | "webkit"
Browser engine. Defaults to
chromium, the only one that can collect coverage. -
changedSince: string
Run only files whose transitive imports changed since this git ref (
'HEAD'for uncommitted). -
console: Console
Where the run's text goes. Defaults to the process streams when a reporter is NAMED, and to silentConsole otherwise — so a programmatic run prints nothing unless it was asked to.
-
coverage: boolean | { formats?: Array<"lcov" | "html">; }
Collect V8 line coverage (chromium only).
formatsadditionally writes lcov/html artifacts. -
cwd: string
Directory the project root and relative inputs resolve against. Defaults to
process.cwd(). -
debug: boolean
Forward every page console call and print the server URL.
-
extensions: string[]
File extensions treated as test files. Defaults to
['js', 'ts', 'jsx', 'tsx']. -
failFast: boolean
Stop the run at the first failing test.
-
filter: string
Run only tests whose
"Module: test name"matches. QUnit's own semantics: case-insensitive substring,/regex/,/regex/i, or a leading!to invert. -
html: string[]
HTML fixture files to wrap the bundle in, relative to the project root.
-
inputs: string[]
Files, directories, globs, or
file.ts#34line targets — the same grammar as the command line's positional arguments. Defaults topackage.json#qunitx.inputs. -
junit: boolean | string
Write a JUnit XML report.
truewrites<output>/junit.xml; a string is a path. -
onlyFailed: boolean
Run only the files that failed last time, from the persistent failure cache.
-
open: boolean | string
Open the output in a browser:
truefor the default, a string to name a binary. -
output: string
Directory for the compiled bundle and HTML output. Defaults to
'tmp'. -
plugins: EsbuildPlugin[]
esbuild plugins for the test bundle — live objects, not specifiers.
-
port: number
Port for the local test server. Defaults to 1234, incrementing on conflict.
-
reporter: ReporterOption
Print the run with ONE reporter: a built-in name (
'tap','spec','dot','github'), your own Reporter, orfalse. The same spelling as the CLI's--reporter. -
reporters: ReadonlyArray<ReporterOption>
Print the run with SEVERAL. Mutually exclusive with UserRunOptions.reporter: pass
reporterfor one,reportersfor many, and validate rejects both at once. -
signal: AbortSignal
Cancels the run when it fires.
-
timeout: number
Milliseconds a single test may take before the run is declared stalled. Defaults to 20000.
The one failure validate raises.
--reporter by name, a reporter of your own, or false for none.
An option was given a value the runner will not accept.
Usage
import * as mod from "lib/api/options.ts";