Muex.Runner (Muex v0.11.2)

View Source

Runs tests against mutated code.

Executes the test suite for each mutation and classifies the results.

Summary

Functions

Runs all mutations in parallel using a global worker pool with sandbox isolation.

Types

mutation_result()

@type mutation_result() :: %{
  mutation: map(),
  result: result(),
  duration_ms: non_neg_integer(),
  error: term() | nil,
  test_files: [String.t()]
}

result()

@type result() ::
  :killed | :survived | :invalid | :timeout | :equivalent | :no_coverage

Functions

run_all(mutations, file_entries, language_adapter, dependency_map, file_to_module, opts \\ [])

@spec run_all(
  [map()],
  %{required(Path.t()) => map()},
  module(),
  map(),
  map(),
  keyword()
) ::
  [mutation_result()] | {:error, String.t()}

Runs all mutations in parallel using a global worker pool with sandbox isolation.

Mutations targeting different files run concurrently. Mutations targeting the same file are serialized via per-file locking.

Parameters

  • mutations - List of all mutations to test (across all files)
  • file_entries - Map of file paths to file entry maps
  • language_adapter - The language adapter module
  • dependency_map - Map of modules to test files
  • file_to_module - Map of file paths to module names
  • opts - Options:
    • :max_workers - Maximum concurrent workers (default: 4)
    • :timeout_ms - Test timeout in milliseconds (default: 5000)
    • :test_paths - List of test path patterns (default: ["test"])
    • :verbose - Show progress (default: false)

Returns

List of mutation_result maps, or {:error, reason} when the run was refused before any mutant ran (see Muex.Sandbox.Error) or stopped because something outside the mutants is broken.