Muex.TestRunner.Port (Muex v0.8.0)

View Source

Runs tests in isolated Erlang port processes.

Each test run executes in a separate BEAM VM via port, providing complete isolation between mutations and preventing hot-swapping conflicts.

The worker pool deletes the .beam file for the mutated module before calling this runner. mix test performs incremental compilation automatically, so only the single mutated file is recompiled — no compile --force needed. This is critical for umbrella projects where a forced recompile takes minutes per mutation.

Summary

Functions

Runs tests in an isolated port process.

Types

test_result()

@type test_result() :: %{
  failures: non_neg_integer(),
  output: String.t(),
  exit_code: non_neg_integer(),
  duration_ms: non_neg_integer()
}

Functions

run_tests(test_files, opts \\ [])

@spec run_tests(
  [Path.t()],
  keyword()
) :: {:ok, test_result()} | {:error, term()}

Runs tests in an isolated port process.

Parameters

  • test_files - List of test file paths to execute
  • opts - Options:
    • :timeout_ms - Test timeout in milliseconds (default: 5000)
    • :mix_env - Mix environment (default: "test")
    • :cd - Working directory for the port process (default: current dir). When running inside a sandbox, this should be the sandbox root.

Returns

{:ok, test_result} or {:error, reason}