@zuke/vitest
`@zuke/vitest` — typed `vitest` task wrappers for Zuke builds.
@zuke/vitest on JSR ↗ 4 symbols
Symbols
type VitestPool = threads | forks | vmThreads | vmForks The Vitest worker pool implementation (--pool).
class VitestSettings extends ToolSettings Settings for a vitest run.
| Member | Signature | Doc |
|---|---|---|
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). |
const VitestTasks: VitestTasksApi Typed task functions for the vitest test runner.
interface VitestTasksApi The shape of VitestTasks.
| Member | Signature | Doc |
|---|---|---|
run | run(configure?: Configure<VitestSettings>): Promise<CommandOutput> | Run tests with vitest (one-shot run unless VitestSettings.watch). |