zuke.tools.jest

← Python API reference

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

Symbols

#

JestSettings

class
class JestSettings(ToolSettings)

Settings for a jest run.

  • paths(*values: str) -> Self

    Regex patterns matched against test paths (positional); repeatable.

  • config(path: str) -> Self

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

  • coverage() -> Self

    Collect test coverage (--coverage).

  • watch() -> Self

    Watch files related to changed files (--watch).

  • watch_all() -> Self

    Watch all files (--watchAll).

  • ci() -> Self

    Run in CI mode, failing on new snapshots (--ci).

  • run_in_band() -> Self

    Run all tests serially in the current process (-i/--runInBand).

  • max_workers(value: str | float) -> Self

    Limit worker count, e.g. 2 or 50% (--maxWorkers).

  • update_snapshot() -> Self

    Re-record snapshots (-u/--updateSnapshot).

  • bail(suites: float | None=None) -> Self

    Stop after N failing test suites (--bail).

  • verbose() -> Self

    Report each individual test (--verbose).

  • silent() -> Self

    Prevent tests from printing to the console (--silent).

  • test_name_pattern(pattern: str) -> Self

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

  • only_changed() -> Self

    Run only tests affected by changed files (-o/--onlyChanged).

  • pass_with_no_tests() -> Self

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

  • detect_open_handles() -> Self

    Detect handles keeping the process open (--detectOpenHandles).

  • select_projects(*names: str) -> Self

    Restrict to named projects (--selectProjects); repeatable.

  • reporters(*names: str) -> Self

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

#

JestTasks

class
class JestTasks

Typed task functions for the jest test runner.

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

    Run tests with jest.