Buckets:
37 GB
4,042,753 files
Updated about 1 month ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| src | 2 items | ||
| tests | 2 items | ||
| CHANGELOG.md | 2.86 kB xet | 2d6100fc | |
| README.md | 3.94 kB xet | 44267ac3 | |
| deno.json | 408 Bytes xet | 3f5396bd | |
| mod.ts | 519 Bytes xet | eb54eb25 |
@zuke/vitest
Typed vitest task wrappers for
Zuke builds, in a fluent
settings-lambda API. Arguments stay a discrete argv array, so command
construction is injection-free.
Vitest defaults to watch mode when invoked bare; this wrapper emits the one-shot
run subcommand by default (CI-friendly) and switches to watch with
.watch().
import { VitestTasks } from "@zuke/vitest";
await VitestTasks.run((s) => s.coverage().reporter("dot").bail(1));
Paths
Every path argument accepts either a string or an AbsolutePath from
@zuke/core, so a path built with absolutePath can be passed in directly.
API
Full typed API — generated from deno doc
`@zuke/vitest` — typed `vitest` task wrappers for Zuke builds.
Configure a fluent settings object in a lambda; the task builds the argv and
runs it. The one-shot `run` subcommand is emitted by default; switch to
watch mode with `.watch()`.
```ts
import { VitestTasks } from "@zuke/vitest";
await VitestTasks.run((s) => s.coverage().reporter("dot"));
```
@module
const VitestTasks: VitestTasksApi
Typed task functions for the `vitest` test runner.
class VitestSettings extends ToolSettings
Settings for a `vitest` run.
override protected defaultTool(): string
The underlying tool binary (`vitest`).
override protected defaultResolution(): ToolResolution
Resolve the binary from `node_modules/.bin` by default — vitest is an npm-distributed tool.
filters(...values: string[]): this
Filename filters matched against test files (positional); repeatable.
watch(): this
Use watch mode (`watch`) instead of the default one-shot `run`.
config(path: PathLike): this
Use an explicit config file (`-c`/`--config`).
root(path: PathLike): this
Project root (`--root`).
dir(path: PathLike): this
Restrict the scanned directory (`--dir`).
coverage(): this
Collect test coverage (`--coverage`).
ui(): this
Open the Vitest UI (`--ui`).
update(): this
Update snapshots (`-u`/`--update`).
forceRun(): this
Force one-shot mode even under watch (`--run`).
pool(name: VitestPool): this
Choose the worker pool implementation (`--pool`).
maxWorkers(count: number): this
Cap the number of parallel workers (`--maxWorkers`).
minWorkers(count: number): this
Set the minimum number of parallel workers (`--minWorkers`).
bail(count: number): this
Stop after N failed tests (`--bail`).
retry(count: number): this
Retry failed tests up to N times (`--retry`).
shard(value: string): this
Run a shard of the suite, e.g. `1/4` (`--shard`).
reporter(...names: string[]): this
Use the named reporters (`--reporter`); repeatable.
outputFile(path: PathLike): this
Write report output to a file (`--outputFile`).
testNamePattern(pattern: string): this
Run only tests whose name matches the pattern (`-t`/`--testNamePattern`).
environment(value: string): this
Test environment, e.g. `jsdom`, `node` (`--environment`).
globals(): this
Enable global test APIs (`--globals`).
passWithNoTests(): this
Pass when no tests are found (`--passWithNoTests`).
silent(): this
Suppress test console output (`--silent`).
override protected onOutput(output: CommandOutput): void
Report the run's counts onto the build summary (see the module docs).
override protected buildArgs(): string[]
Assemble the `vitest run`/`vitest watch` argv.
interface VitestTasksApi
The shape of {@link VitestTasks}.
run(configure?: Configure<VitestSettings>): Promise<CommandOutput>
Run tests with `vitest` (one-shot `run` unless {@link VitestSettings.watch}).
type VitestPool = "threads" | "forks" | "vmThreads" | "vmForks"
The Vitest worker pool implementation (`--pool`).
- Total size
- 37 GB
- Files
- 4,042,753
- Last updated
- Oct 24
- Pre-warmed CDN
- US EU US EU