zuke.tools.vitest

← Python API reference

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

Symbols

#

VitestSettings

class
class VitestSettings(ToolSettings)

Settings for a vitest run.

  • filters(*values: str) -> Self

    Filename filters matched against test files (positional); repeatable.

  • watch() -> Self

    Use watch mode (watch) instead of the default one-shot run.

  • config(path: str) -> Self

    Use an explicit config file (-c/--config).

  • root(path: str) -> Self

    Project root (--root).

  • dir(path: str) -> Self

    Restrict the scanned directory (--dir).

  • coverage() -> Self

    Collect test coverage (--coverage).

  • ui() -> Self

    Open the Vitest UI (--ui).

  • update() -> Self

    Update snapshots (-u/--update).

  • force_run() -> Self

    Force one-shot mode even under watch (--run).

  • pool(name: Literal['threads', 'forks', 'vmThreads', 'vmForks']) -> Self

    Choose the worker pool implementation (--pool).

  • max_workers(count: float) -> Self

    Cap the number of parallel workers (--maxWorkers).

  • min_workers(count: float) -> Self

    Set the minimum number of parallel workers (--minWorkers).

  • bail(count: float) -> Self

    Stop after N failed tests (--bail).

  • retry(count: float) -> Self

    Retry failed tests up to N times (--retry).

  • shard(value: str) -> Self

    Run a shard of the suite, e.g. 1/4 (--shard).

  • reporter(*names: str) -> Self

    Use the named reporters (--reporter); repeatable.

  • output_file(path: str) -> Self

    Write report output to a file (--outputFile).

  • test_name_pattern(pattern: str) -> Self

    Run only tests whose name matches the pattern (-t/--testNamePattern).

  • environment(value: str) -> Self

    Test environment, e.g. jsdom, node (--environment).

  • globals() -> Self

    Enable global test APIs (--globals).

  • pass_with_no_tests() -> Self

    Pass when no tests are found (--passWithNoTests).

  • silent() -> Self

    Suppress test console output (--silent).

#

VitestTasks

class
class VitestTasks

Typed task functions for the vitest test runner.

  • static async run(ctx: ServiceContext, configure: Callable[[VitestSettings], VitestSettings] | None=None) -> ExecResult

    Run tests with vitest (one-shot run unless VitestSettings.watch).