Excessibility.Capture (Excessibility v0.14.0)

View Source

Tracks capture state for auto-snapshot functionality.

When @tag capture_snapshots: true is used, this module tracks:

  • Event sequence (counter)
  • Previous snapshot name
  • Test metadata
  • Timeline events

Summary

Functions

Clears the capture state.

Returns the current capture state, or nil if not capturing.

Returns the timeline of all events for the current test.

Initializes capture state for a test.

Initializes a lightweight :default-mode context for a test.

Records a snapshot event and increments the sequence counter. Returns metadata for the snapshot.

Saves the timeline to a JSON file.

Functions

clear_state()

Clears the capture state.

get_state()

Returns the current capture state, or nil if not capturing.

get_timeline()

Returns the timeline of all events for the current test.

init_capture(test_name, opts \\ [], mode \\ :auto)

Initializes capture state for a test.

init_default_context(test_name)

Initializes a lightweight :default-mode context for a test.

Unlike init_capture/3 (:auto mode, used by the capture_snapshots tag), this only records the test name and a per-call sequence so that every snapshot embeds Test:/Sequence: metadata for cross-snapshot diffing — the default Module_line.html filename scheme is preserved.

record_event(event_type, assigns \\ %{})

Records a snapshot event and increments the sequence counter. Returns metadata for the snapshot.

save_timeline()

Saves the timeline to a JSON file.