Juggernaut.Coverage (Juggernaut v0.4.0)

Copy Markdown View Source

Coverage for a run (design notes §10.5): which tests each mutant runs.

run/3 takes the booted pool and the build, decides what to probe from the coverage index (Juggernaut.Coverage.Index.stale/2), probes those test files (Juggernaut.Coverage.Probe), updates the index, and gives every mutant its selection (Juggernaut.Coverage.Selection): the tests that hit its site, the whole file, the whole suite (with the reason), the boot lane, or none (no_coverage).

Summary

Functions

The keys of the mutants of the boot set's sites.

The runnable (not excluded) tests of the boot inventory, by test file.

Coverage of mutants (each with its switch). Options

Each mutant's selection by its id, from the labels by key and the boot keys.

Each site (first switch) with its mutants, from the build's sites.

Types

id()

@type id() :: {module(), atom()}

result()

@type result() :: %{
  index: Juggernaut.Coverage.Index.t(),
  selections: %{required(String.t()) => Juggernaut.Coverage.Selection.t()},
  probed: %{required(String.t()) => Juggernaut.Coverage.Probe.file_result()},
  stale: {:all, String.t()} | {:files, %{required(String.t()) => String.t()}}
}

Functions

boot_keys(boot_sites, site_mutants)

@spec boot_keys([pos_integer()], %{required(pos_integer()) => [Juggernaut.Mutant.t()]}) ::
  MapSet.t(String.t())

The keys of the mutants of the boot set's sites.

inventory(tests)

@spec inventory(%{required(id()) => %{file: String.t(), excluded?: boolean()}}) :: %{
  required(String.t()) => [id()]
}

The runnable (not excluded) tests of the boot inventory, by test file.

run(mutants, opts)

@spec run([Juggernaut.Mutant.t()], keyword()) ::
  {:ok, result()} | {:error, Juggernaut.Error.t()}

Coverage of mutants (each with its switch). Options:

selections(mutants, labels, boot, inventory)

@spec selections(
  [Juggernaut.Mutant.t()],
  %{required(String.t()) => [Juggernaut.Coverage.Selection.label()]},
  MapSet.t(),
  map()
) :: %{required(String.t()) => Juggernaut.Coverage.Selection.t()}

Each mutant's selection by its id, from the labels by key and the boot keys.

site_mutants(sites, mutants)

@spec site_mutants(%{required(pos_integer()) => [pos_integer()]}, [
  Juggernaut.Mutant.t()
]) :: %{
  required(pos_integer()) => [Juggernaut.Mutant.t()]
}

Each site (first switch) with its mutants, from the build's sites.