ExUnit formatter that outputs test results as JSON.
This GenServer receives events from ExUnit during test execution and accumulates results. When the test suite finishes, it outputs a complete JSON document with all test results and summary statistics.
Usage
Configure ExUnit to use this formatter:
ExUnit.configure(formatters: [ExUnitJSON.Formatter])Or use the mix test.json task which configures this automatically.
Events Handled
{:suite_started, opts}- Captures seed and start time{:test_finished, test}- Accumulates individual test results{:module_finished, module}- Tracks module-level failures (setup_all){:suite_finished, times_us}- Outputs final JSON
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type t() :: %ExUnitJSON.Formatter{ modules: [map()], opts: keyword(), seed: non_neg_integer() | nil, start_time: integer() | nil, tests: [map()] }
Formatter state accumulating test results during a test run
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.