API Reference MixAffected v#0.1.0

Copy Markdown View Source

Modules

Nx-style "affected" selection for Elixir projects: given the source files a change touched, which files may now behave differently?

Where a change set comes from: --files <path|-> or --base <git-ref>.

Sorts a change set into what it means for test selection. Each changed file gets the first rule that applies

The affected: settings of the consuming project, plus the test layout (:test_paths, :test_pattern) Mix itself uses to find test files.

Matches root-relative paths against shell-style globs without touching the filesystem, so deleted files match too.

File-level dependency graph of a compiled Mix project.

Behaviour for producing a project's raw file dependency graph.

MixAffected.Graph.Source over mix xref graph --format dot, the adapter for Elixir 1.18 (which has no JSON format).

MixAffected.Graph.Source over mix xref graph --format json (Elixir >= 1.19).

Compares a saved selection with the failures of the last full mix test.

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

One selection, end to end: classify the change set, build the graph only if a source changed, build or read the test map only if anything is affected, add the map's protocol-impl edges to the graph, then select.

Picks the test files to run from the seeds of a change (changed sources the graph knows, plus changed test files) and the test map.

Which source files each test file references, built by mix affected.map (see MixAffected.TestMap.Builder) and stored as an ETF file, by default at _build/test/mix_affected/test_map.etf.

Reads a test file's source without compiling it: the modules it names (the fallback when requiring the file fails) and its affected_by globs.

Builds a MixAffected.TestMap inside the consuming project's VM, the way mix test loads tests but without running any: the project must already be compiled (and its apps started, as mix test does) by the caller.

Compiler tracer for MixAffected.TestMap.Builder. While test files are required, records in the table/0 ETS bag

Mix Tasks

Prints the test files a change set may affect. Run with MIX_ENV=test.

Builds the test map mix affected.files and mix affected.test select with, at _build/test/mix_affected/test_map.etf or --map <path>. Those tasks build it themselves when it is missing. Run with MIX_ENV=test.

After a full mix test, compares ExUnit's failures manifest (the file mix test --failed reads) with a selection saved by mix affected.files --format json. Run with MIX_ENV=test.

Runs mix test on the affected test files. Takes the input options of mix affected.files (--base or --files, --map); everything after -- goes to mix test unchanged. Run with MIX_ENV=test.