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
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.
Directory the project root and relative inputs resolve against. Defaults to process.cwd().
Run only tests whose "Module: test name" matches. QUnit's own semantics: case-insensitive
substring, /regex/, /regex/i, or a leading ! to invert.
Browser engine. Defaults to chromium, the only one that can collect coverage.
Milliseconds a single test may take before the run is declared stalled. Defaults to 20000.
Run only the files that failed last time, from the persistent failure cache.
Run only files whose transitive imports changed since this git ref ('HEAD' for uncommitted).
Collect V8 line coverage (chromium only). formats additionally writes lcov/html artifacts.
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.
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.
Set it to capture the built-in reporters' output, which is the only way to reach it:
console: streamConsole(myBuffer).
File extensions treated as test files. Defaults to ['js', 'ts', 'jsx', 'tsx'].
Path to a module run before the tests; it receives the resolved config.
Path to a module run after the tests; it receives the run's counters.
esbuild plugins for the test bundle — live objects, not specifiers.
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.