Muex.Reporter.Json (Muex v0.13.1)

View Source

JSON reporter for mutation testing results.

Exports results in structured JSON format for CI/CD integration.

Each mutation entry includes a patch object with before and after code snippets (or null when the mutation does not carry the original and mutated AST), so survived mutants can be reproduced from the report alone.

Summary

Functions

Generates JSON report from mutation results.

Returns JSON string from mutation results without writing to file.

Functions

generate(results, opts \\ [])

@spec generate(
  [map()],
  keyword()
) :: :ok | {:error, term()}

Generates JSON report from mutation results.

Parameters

  • results - List of mutation results
  • opts - Options:
    • :output_file - Path to output file (default: "muex-report.json")
    • :partial - %{mutations_run: n, mutations_total: m} when the run hit its deadline; adds partial: true, mutations_run and mutations_total to the summary. Absent otherwise, so a complete report is unchanged.

Returns

:ok after writing the JSON file

to_json(results, opts \\ [])

@spec to_json(
  [map()],
  keyword()
) :: String.t()

Returns JSON string from mutation results without writing to file.

Parameters

  • results - List of mutation results
  • opts - As for generate/2 (:partial)

Returns

JSON string