interface ScriptConfig

Everything one qunitx run invocation needs. Its own type rather than the test runner's Config: a script has no test files, no filter, no reporter and no output directory, and threading a script mode through those would make every one of them mean two things.

import { silentConsole } from '../console.ts';

const config: ScriptConfig = {
  entry: '/proj/seed.ts',
  projectRoot: '/proj',
  cwd: '/proj',
  browser: 'chromium',
  port: 1234,
  portExplicit: false,
  watch: false,
  open: false,
  timeout: null,
  console: silentConsole,
};
config.timeout; // null — unbounded, like `deno run`

Properties

entry: string

Absolute path of the script to run.

Directory holding the nearest package.json; mapped stack frames print relative to it.

cwd: string

Directory relative imports and node_modules lookups resolve from.

browser: "chromium" | "firefox" | "webkit"

Engine the script runs in.

port: number

Port the local server binds. Updated in place to the port actually bound.

True when --port was given, which makes a taken port an error instead of a search.

watch: boolean

--watch: re-run on every save instead of exiting after one run.

open: boolean

--open: run in a visible browser window.

timeout: number | null

--timeout: ms the script may run before it is declared hung, or null for unbounded.

Where the script's own output goes. processConsole for the CLI.

optional
reporter: Args.ParsedFlags["reporter"]

Reporting settings that only matter if the entry turns out to declare tests.

Kept as the user typed them rather than resolved: a plain script never builds a suite config at all, so there is nothing to resolve them against until there is something to report.

optional
junit: Args.ParsedFlags["junit"]

--junit: writes a JUnit XML report for a declared suite.

optional
debug: Args.ParsedFlags["debug"]

--debug: prints the server URL and the page's console, as the bare verb's does.

optional
filter: Args.ParsedFlags["filter"]

--filter: narrows a declared suite to matching tests.

Usage

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