Centralized configuration handling for ExUnitJSON.
Provides option parsing, validation, and retrieval. Options are stored in Application environment during test runs (single-instance, so this is acceptable).
Options
:summary_only- When true, omit individual test results:failures_only- When true, include only failed tests:first_failure- When true, include only the first failed test:filter_out- List of patterns to mark matching failures as filtered:output- File path to write JSON output (default: stdout):compact- When true, output JSONL with minimal fields:group_by_error- When true, add error_groups array grouping failures by message
Summary
Functions
Checks if compact mode is enabled.
Checks if failures-only mode is enabled.
Gets the list of filter-out patterns.
Checks if first-failure mode is enabled.
Gets a specific option value.
Gets options from Application environment.
Checks if group-by-error mode is enabled.
Gets the output file path, or nil for stdout.
Checks if summary-only mode is enabled.
Types
@type option() ::
:summary_only
| :failures_only
| :first_failure
| :filter_out
| :output
| :compact
| :group_by_error
Valid option keys for ExUnitJSON configuration
@type opts() :: [ summary_only: boolean(), failures_only: boolean(), first_failure: boolean(), filter_out: [String.t()], output: String.t() | nil, compact: boolean(), group_by_error: boolean() ]
Keyword list of ExUnitJSON options
Functions
@spec compact?() :: boolean()
Checks if compact mode is enabled.
@spec failures_only?() :: boolean()
Checks if failures-only mode is enabled.
Returns true by default (AI-optimized output). Use --all flag to get all tests.
@spec filter_out_patterns() :: [String.t()]
Gets the list of filter-out patterns.
@spec first_failure?() :: boolean()
Checks if first-failure mode is enabled.
Gets a specific option value.
Examples
Application.put_env(:ex_unit_json, :opts, summary_only: true)
ExUnitJSON.Config.get_opt(:summary_only)
#=> true
Application.put_env(:ex_unit_json, :opts, [])
ExUnitJSON.Config.get_opt(:summary_only, false)
#=> false
@spec get_opts() :: opts()
Gets options from Application environment.
Returns validated options, filtering out any invalid keys.
Examples
Application.put_env(:ex_unit_json, :opts, summary_only: true)
ExUnitJSON.Config.get_opts()
#=> [summary_only: true]
Application.put_env(:ex_unit_json, :opts, invalid_key: "ignored")
ExUnitJSON.Config.get_opts()
#=> []
@spec group_by_error?() :: boolean()
Checks if group-by-error mode is enabled.
@spec output_path() :: String.t() | nil
Gets the output file path, or nil for stdout.
@spec summary_only?() :: boolean()
Checks if summary-only mode is enabled.