# `ExUnitJSON.Config`
[🔗](https://github.com/ZenHive/ex_unit_json/blob/main/lib/ex_unit_json/config.ex#L1)

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
  * `:quiet` - When true, suppress Logger output for clean JSON
  * `:hint` - Hint message string suggesting `--failed` (set by the Mix task,
    surfaced as a top-level `hint` key in the JSON output)
  * `:retry` - When false (via `--no-retry`), disable auto-retry of failed tests

# `option`

```elixir
@type option() ::
  :summary_only
  | :failures_only
  | :first_failure
  | :filter_out
  | :output
  | :compact
  | :group_by_error
  | :quiet
  | :hint
  | :retry
```

Valid option keys for ExUnitJSON configuration

# `opts`

```elixir
@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(),
  quiet: boolean(),
  hint: String.t(),
  retry: boolean()
]
```

Keyword list of ExUnitJSON options

# `compact?`

```elixir
@spec compact?() :: boolean()
```

Checks if compact mode is enabled.

# `failures_only?`

```elixir
@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.

# `filter_out_patterns`

```elixir
@spec filter_out_patterns() :: [String.t()]
```

Gets the list of filter-out patterns.

# `first_failure?`

```elixir
@spec first_failure?() :: boolean()
```

Checks if first-failure mode is enabled.

# `get_opt`

```elixir
@spec get_opt(option(), any()) :: any()
```

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

# `get_opts`

```elixir
@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()
    #=> []

# `group_by_error?`

```elixir
@spec group_by_error?() :: boolean()
```

Checks if group-by-error mode is enabled.

# `output_path`

```elixir
@spec output_path() :: String.t() | nil
```

Gets the output file path, or nil for stdout.

# `retry?`

```elixir
@spec retry?() :: boolean()
```

Checks if automatic retry-on-flaky is enabled via project config.

Reads `config :ex_unit_json, :retry` directly from the application
environment (default `true`), mirroring how `:enforce_failed` is read. This
is a project-level setting evaluated before per-invocation `:opts` are stored,
so it deliberately does not consult `get_opts/0`. The `--no-retry` flag is
honored separately as a per-invocation opt by `Mix.Tasks.Test.Json`.

# `summary_only?`

```elixir
@spec summary_only?() :: boolean()
```

Checks if summary-only mode is enabled.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
