@zuke/vitest

← API reference

`@zuke/vitest` — typed `vitest` task wrappers for Zuke builds.

Symbols

# VitestPool type
type VitestPool = threads | forks | vmThreads | vmForks

The Vitest worker pool implementation (--pool).

# VitestSettings class
class VitestSettings extends ToolSettings

Settings for a vitest run.

MemberSignatureDoc
filters filters(...values: string[]): this Filename filters matched against test files (positional); repeatable.
watch watch(): this Use watch mode (watch) instead of the default one-shot run.
config config(path: PathLike): this Use an explicit config file (-c/--config).
root root(path: PathLike): this Project root (--root).
dir dir(path: PathLike): this Restrict the scanned directory (--dir).
coverage coverage(): this Collect test coverage (--coverage).
ui ui(): this Open the Vitest UI (--ui).
update update(): this Update snapshots (-u/--update).
forceRun forceRun(): this Force one-shot mode even under watch (--run).
pool pool(name: VitestPool): this Choose the worker pool implementation (--pool).
maxWorkers maxWorkers(count: number): this Cap the number of parallel workers (--maxWorkers).
minWorkers minWorkers(count: number): this Set the minimum number of parallel workers (--minWorkers).
bail bail(count: number): this Stop after N failed tests (--bail).
retry retry(count: number): this Retry failed tests up to N times (--retry).
shard shard(value: string): this Run a shard of the suite, e.g. 1/4 (--shard).
reporter reporter(...names: string[]): this Use the named reporters (--reporter); repeatable.
outputFile outputFile(path: PathLike): this Write report output to a file (--outputFile).
testNamePattern testNamePattern(pattern: string): this Run only tests whose name matches the pattern (-t/--testNamePattern).
environment environment(value: string): this Test environment, e.g. jsdom, node (--environment).
globals globals(): this Enable global test APIs (--globals).
passWithNoTests passWithNoTests(): this Pass when no tests are found (--passWithNoTests).
silent silent(): this Suppress test console output (--silent).
# VitestTasks const
const VitestTasks: VitestTasksApi

Typed task functions for the vitest test runner.

# VitestTasksApi interface
interface VitestTasksApi

The shape of VitestTasks.

MemberSignatureDoc
run run(configure?: Configure<VitestSettings>): Promise<CommandOutput> Run tests with vitest (one-shot run unless VitestSettings.watch).