Generates a new test file from the boilerplate template.
Prints qunitx-cli usage information to stdout.
Bootstraps a new qunitx project: writes the test HTML template, updates package.json, and optionally writes tsconfig.json.
Runs qunitx tests in headless Chrome, either in watch mode or concurrent batch mode.
Pre-builds the esbuild bundle for all test files and caches the result in cachedContent.
Runs the esbuild-bundled tests inside a Playwright-controlled browser page and streams TAP output.
Minimal HTTP + WebSocket server used to serve test bundles and push reload events.
-
_server: http.Server
Underlying Node.js HTTP server instance.
-
close(): Promise<void>
Closes the underlying HTTP server and all active connections, returning a Promise that resolves once the server is fully closed.
-
delete(): voidpath: string,handler: RouteHandler
Registers a DELETE route handler.
-
get(): voidpath: string,handler: RouteHandler
Registers a GET route handler.
-
listen(): Promise<void>port?: number,callback?: () => void
Starts listening on the given port (0 = OS-assigned).
-
middleware: Middleware[]
Registered middleware functions, applied in order before each route handler.
-
post(): voidpath: string,handler: RouteHandler
Registers a POST route handler.
-
publish(data: string): void
Broadcasts a message to all connected WebSocket clients.
-
put(): voidpath: string,handler: RouteHandler
Registers a PUT route handler.
-
routes: Record<string, Record<string, Route>>
Registered routes keyed by HTTP method then path.
-
serve(): Promise<http.Server>config?: { port: number; onListen?: (s: object) => void; onError?: (e: Error) => void; },handler: () => voidreq: http.IncomingMessage,res: http.ServerResponse
Creates and starts a plain
http.createServerinstance on the given port. -
use(middleware: Middleware): void
Adds a middleware function to the chain.
-
wss: WebSocketServer
WebSocket server attached to the HTTP server for live-reload broadcasts.
Middleware function signature — call next() to continue the chain.
Route handler function signature for registered GET/POST/etc. routes.
Map of file extensions to their corresponding MIME type strings.
Binds an HTTPServer to an OS-assigned port and writes the resolved port back to config.port.
Launches a browser for the given config.browser type.
For chromium: connects via CDP to the pre-launched Chrome (fast path) or falls
back to chromium.launch() if pre-launch failed.
For firefox/webkit: uses playwright's standard launch (requires npx playwright install [browser]).
Launches a Playwright browser (or reuses an existing one), starts the web server, and returns the page/server/browser connection object.
Builds the merged qunitx config from package.json settings and CLI flags.
Default qunitx config values: build output directory, test timeout (ms), fail-fast flag, HTTP server port, and tracked file extensions.
Routes a file-system event to fsTree mutation and optional rebuild trigger.
unlinkDir bypasses the extension filter so deleted directories always clean up fsTree.
Mutates fsTree in place based on a chokidar file-system event.
Starts fs.watch watchers for each lookup path and calls onEventFunc on JS/TS file changes, debounced via a flag.
Uses config.fsTree to distinguish unlink (tracked file) from unlinkDir (directory) on deletion.
Resolves an array of file paths, directories, or glob patterns into a flat { absolutePath: null } map.
Registers watch-mode keyboard shortcuts: qq to abort, qa to run all, qf for last failed, ql for last run.
Deduplicates a list of file, folder, and glob inputs so that more-specific paths covered by broader ones are removed.
Creates and returns an HTTPServer with routes for the test HTML, filtered test page, and static assets, plus a WebSocket handler that streams TAP events.
Copies static HTML files and referenced assets from the project into the configured output directory.
Prints the TAP plan line and test-run summary (total, pass, skip, fail, duration).
Formats and prints a single QUnit testEnd event as a TAP ok/not ok line with optional YAML failure block.
Serializes the fixed TAP assertion object to a YAML string. Uses a template literal (no Object.entries overhead) for the known top-level keys.
- COUNTER: Counter
- _building: boolean
- _groupMode: boolean
- _resetTestTimeout: (() => void) | null
- _testRunDone: (() => void) | null
- after: string | false
- before: string | false
- browser: "chromium" | "firefox" | "webkit"
- debug: boolean
- expressApp: unknown
- extensions: string[]
- failFast: boolean
- fsTree: FSTree
- htmlPaths: string[]
- inputs: string[]
- lastFailedTestFiles: string[] | null
- lastRanTestFiles: string[] | null
- output: string
- port: number
- projectRoot: string
- testFileLookupPaths: string[]
- timeout: number
- watch: boolean
Launch args passed to Chromium for both the CDP pre-launch spawn and the playwright fallback launch.
ANSI blue text.
Creates a set of ANSI color helpers with coloring enabled or disabled.
ANSI green text.
ANSI magenta text. Call without arguments to chain: magenta().bold(text).
ANSI red text.
ANSI yellow text.
Resolves to { proc, cdpEndpoint } when Chrome is pre-launched and ready,
or null if pre-launch was skipped (non-run command or non-chromium browser).
Resolves the Chrome/Chromium executable path. Returns a Promise for API compatibility with callers, but the resolution is synchronous.
Parses an HTML string and returns all internal (non-absolute-URL) <script src> and <link href> paths.
Walks up parent directories from cwd to find the nearest package.json and returns its directory path.
Prepends count repetitions of indent (default: one space) to each non-empty line of string.
Registers a stdin listener that fires closure when the user types inputString (case-insensitive by default).
Parses process.argv into a qunitx flag object (inputs, debug, watch, failFast, timeout, output, port, before, after).
Returns true if the given filesystem path is accessible, false otherwise.
Writes a timestamped perf trace line to stderr when --trace-perf is active.
Spawns a headless Chrome process with remote-debugging-port=0 and resolves once the CDP WebSocket endpoint is printed to stderr. Returns null if Chrome is unavailable or fails to start, so callers can fall back to playwright's normal launch.
Reads a boilerplate file by relative path, using the SEA asset store when running as a Node.js binary.
Returns portNumber if it is free, otherwise recursively tries portNumber + 1 until a free port is found.
Dynamically imports modulePath and calls its default export with params; exits with code 1 on error.
Recursively searches directory and its ancestors for a file or folder named targetEntry; returns the absolute path or undefined.
Returns a timer object with a startTime Date and a stop() method that returns elapsed milliseconds.