Excessibility.Snapshot (Excessibility v0.5.13)

View Source

Core snapshot generation and file management.

This module handles:

  • Converting test sources to HTML snapshots
  • Writing snapshots to the filesystem
  • Screenshot generation via ChromicPDF

File Locations

Snapshots are stored in test/excessibility/html_snapshots/ by default. Configure with :excessibility_output_path to change the base directory.

Workflow

  1. Run tests to generate snapshots
  2. Run mix excessibility.baseline to lock in a known-good state
  3. Run mix excessibility.compare to diff against baseline after changes

This module is typically used via the Excessibility.html_snapshot/2 macro rather than called directly.

Summary

Functions

Generates an HTML snapshot from a test source.

Functions

html_snapshot(source, env, module, opts \\ [])

@spec html_snapshot(term(), Macro.Env.t(), module(), keyword()) :: term()

Generates an HTML snapshot from a test source.

Parameters

Options

  • :name - Custom filename (default: ModuleName_LineNumber.html)
  • :screenshot? - Generate PNG screenshots (default: false)
  • :open_browser? - Open snapshot in browser after writing (default: false)
  • :cleanup? - Delete existing snapshots for this module first (default: false)

Returns

The original source, unchanged (for pipeline compatibility).