Runs the whole suite once in headless Chrome and resolves with its RunOutcome.
The qunitx run <file> line a zero-test run suggests, with forward slashes.
Starts a watch session: one browser, one page, every test file in a single bundle, behind an HTTP server that stays up. Resolves once the initial run has finished and the watchers are armed — the returned WatchSession is how the caller stops it again.
How a one-shot run ended. Everything a caller needs to decide what happens next, and nothing about how it should be announced — run neither writes a summary nor exits.
-
durationMs: number
Wall-clock duration of the test phase in milliseconds.
-
exitCode: number
0when every test passed,1for any failure, group rejection, or empty filtered run. -
finishedAt: number
Epoch ms when it ended.
finishedAt - startedAtisdurationMsmodulo clock resolution. -
startedAt: number
Epoch ms when the test phase began — after the bundle, at the first navigation.
A live watch session: the run's browser, server and file watchers, kept open.
-
abort(): void
Tells the browser to drop the rest of the current run's queue.
-
close(): Promise<Abandoned>
Stops the watchers and closes the browser and server. Idempotent.
-
config: Config
The resolved config this session runs with; its
statecarries the live counters. -
connections: Connections
The session's browser, page and HTTP server.
-
fileWatchers: Record<string, FSWatcher>
The live per-path
fs.watchhandles, keyed by watched path — the same object the watcher mutates, not a copy. A PARTIAL view: the parent-directory watchers, rescan intervals and symlink pollerskillFileWatchersalso owns are not in here, so it answers "what is being watched", not "every handle the watcher holds". -
run(files?: string[]): Promise<void>
Re-runs now, optionally scoped to
files; resolves when that run finishes. -
runAll(): Promise<void>
Runs the whole suite, dropping any line-target selectors this session was scoped to.
-
runFailed(): Promise<void>
Re-runs the files that last failed, or repeats the last run when nothing has failed yet.
-
running: boolean
Whether a run is executing or queued — true from the moment one is asked for.
-
settled(): Promise<void>
Resolves once nothing is in flight — a no-op at the back of the rerun queue.
-
teardown(disposeEsbuild?: boolean): Promise<Abandoned>
close minus the two teardowns a restart must not do, because it is building a replacement in the same process rather than ending.
-
url: string
Where the QUnit view is being served, e.g.
http://localhost:1234.
Usage
import * as mod from "lib/commands/test.ts";