Skip to main content

measure_typescript

Function measure_typescript 

Source
pub fn measure_typescript(
    root: &Path,
    exempt: &[String],
    exempt_lines: &BTreeMap<String, BTreeSet<u32>>,
    base: Option<&str>,
    adapter: &Path,
) -> Result<Vec<Survivor>>
Expand description

Run the bundled TypeScript mutation adapter over the project at root and return its un-exempted survivors — the TS arm of the mutation rule (#202), parity with measure_rust.

The consumer installs nothing Stryker-related: the npm package ships a Node adapter that drives Stryker through its own Node API and emits the engine-agnostic NormalizedMutant schema (#239), which this gates over via evaluate_normalized — the same core the Rust and Python arms feed. Only the project’s own test runner (vitest) needs to be present, exactly as cargo-mutants needs a buildable crate and cosmic-ray needs pytest.

With base set, only mutants on the <base>...HEAD changed lines are tested — Stryker has no native git-diff mode, so the changed lines become --mutate <file>:<line>-<line> ranges (line granularity, matching cargo-mutants’ --in-diff). Without it, the project’s configured mutate set runs. exempt is the file-level exempt paths and exempt_lines the line-scoped ones (#226). adapter is the path to the bundled Node adapter (dist/mutation/main.js) — the CLI receives it from the npm launcher’s --ts-mutation-adapter argument and hands it down explicitly.