MixAffected.Result (MixAffected v0.1.0)

Copy Markdown View Source

The answer of mix affected.files / mix affected.test, and its v1 JSON and text renderings (see the README for the schema).

exit_status is 0 for any answer, 2 when the graph or the test map could not be built: the result is then a full run.

Summary

Functions

Marks result as a full run for reason; tests, affected_files and explain are cleared.

A one-line human summary for stderr.

The v1 JSON document. explain is %{} unless explain?.

Text output: one test file per line (with explain?, one chain per line, changed -> ... -> test). A full run prints nothing; its reason goes to stderr (see summary/1).

Types

t()

@type t() :: %MixAffected.Result{
  affected_files: [String.t()],
  changed_files: [String.t()],
  exit_status: 0 | 2,
  explain: %{optional(String.t()) => [String.t()]},
  full_run: boolean(),
  graph_source: String.t(),
  reason: String.t() | nil,
  tests: [String.t()],
  total_test_files: non_neg_integer()
}

Functions

full_run(result, reason, exit_status \\ 0)

@spec full_run(t(), String.t(), 0 | 2) :: t()

Marks result as a full run for reason; tests, affected_files and explain are cleared.

summary(result)

@spec summary(t()) :: String.t()

A one-line human summary for stderr.

to_json(r, explain?)

@spec to_json(t(), boolean()) :: String.t()

The v1 JSON document. explain is %{} unless explain?.

to_text(result, explain?)

@spec to_text(t(), boolean()) :: String.t()

Text output: one test file per line (with explain?, one chain per line, changed -> ... -> test). A full run prints nothing; its reason goes to stderr (see summary/1).