function run
run(config: Config): Promise<number>

--search / -s / --print / --preview: list the tests the current selection matches, without running them.

The listing comes from the same static declaration scanner file#line targets use — no browser, no bundle, no test execution — and matching goes through a port of QUnit's own filter that is differential-tested against a real run, so the preview reflects what an actual run would select. Every axis of the real run is honoured: the -t/-m expression, and file#line line targets (resolved per file, exactly as a real run scopes each group).

The trade-off of scanning instead of executing: a test whose name is computed (test(`case ${i}`)) has no name until the browser runs it, so it cannot be listed. Those are counted and reported rather than silently omitted.

import type { Config } from '../types.ts';
// Defined, not invoked: reads and scans every selected file, prints the listing.
async function searchCommand(config: Config) {
  return await run(config); // 'Cart: checkout  test/cart-test.ts#12' … then the match count
}

Parameters

config: Config

Return Type

Promise<number>

the process exit code: 0 when something matched, 1 when nothing did (as grep does).

Usage

import { run } from "lib/commands/search.ts";