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.
Two things differ from the command line, both because they cannot be typed into a shell:
plugins takes live esbuild plugin objects, and cwd picks the project.
const options: UserRunOptions = { inputs: ['test/'], filter: 'Cart', coverage: true }; options.reporter; // undefined — nothing is printed unless you ask for it
inputs: string[]
Files, directories, globs, or file.ts#34 line targets — the same grammar as the
command line's positional arguments. Defaults to package.json#qunitx.inputs.
cwd: string
Directory the project root and relative inputs resolve against. Defaults to process.cwd().
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.
browser: "chromium" | "firefox" | "webkit"
Browser engine. Defaults to chromium, the only one that can collect coverage.
timeout: number
Milliseconds a single test may take before the run is declared stalled. Defaults to 20000.
failFast: boolean
Stop the run at the first failing test.
onlyFailed: boolean
Run only the files that failed last time, from the persistent failure cache.
changedSince: string
Run only files whose transitive imports changed since this git ref ('HEAD' for uncommitted).
coverage: boolean | { formats?: Array<"lcov" | "html">; }
Collect V8 line coverage (chromium only). formats additionally writes lcov/html artifacts.
junit: boolean | string
Write a JUnit XML report. true writes <output>/junit.xml; a string is a path.
reporter: ReporterOption
Print the run with ONE reporter: a built-in name ('tap', 'spec', 'dot', 'github'),
your own Reporter, or false. The same spelling as the CLI's --reporter.
Omitted means nothing is printed — the result value is the output.
reporters: ReadonlyArray<ReporterOption>
Print the run with SEVERAL. Mutually exclusive with UserRunOptions.reporter: pass
reporter for one, reporters for many, and validate rejects both at once.
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.
Set it to capture the built-in reporters' output, which is the only way to reach it:
console: streamConsole(myBuffer).
output: string
Directory for the compiled bundle and HTML output. Defaults to 'tmp'.
port: number
Port for the local test server. Defaults to 1234, incrementing on conflict.
extensions: string[]
File extensions treated as test files. Defaults to ['js', 'ts', 'jsx', 'tsx'].
html: string[]
HTML fixture files to wrap the bundle in, relative to the project root.
before: string | false
Path to a module run before the tests; it receives the resolved config.
after: string | false
Path to a module run after the tests; it receives the run's counters.
plugins: EsbuildPlugin[]
esbuild plugins for the test bundle — live objects, not specifiers.
debug: boolean
Forward every page console call and print the server URL.
open: boolean | string
Open the output in a browser: true for the default, a string to name a binary.
signal: AbortSignal
Cancels the run when it fires.
Cancellation here means "stop and answer", not "throw": the browser drops the rest of its
queue and the run resolves with whatever it had, marked aborted: true. The tests that did
finish are still on the result, which is the point — a cancelled run that discarded its own
findings would be no more useful than one that never started.
An already-aborted signal short-circuits: no browser is launched at all.