Mace.Formatter (mace v0.1.0)

Copy Markdown

Stores config diffs for display on test failure.

Used internally by Mace.cleanup/1 in on_exit callbacks. The diff data is read by an ExUnit formatter (registered separately) that injects diffs into test failure output.

Usage in tests

setup context do
  Mace.set(:my_app, :timeout, 100)
  on_exit(fn -> Mace.cleanup(context) end)
  :ok
end

The cleanup/1 call records the current process's config diffs (keyed by the test's module and name) and then resets the config. On test failure, the formatter reads and displays the diff.

Summary

Functions

Clears the recorded diff for a given test.

Returns the recorded diff for a given test.

Records the current process's config diffs for the given test. Called by Mace.cleanup/1.

Functions

clear(module, test_name)

Clears the recorded diff for a given test.

lookup(module, test_name)

Returns the recorded diff for a given test.

record(module, test_name)

Records the current process's config diffs for the given test. Called by Mace.cleanup/1.