Skip to main content

Module snapshots

Module snapshots 

Source
Expand description

#2842: the driver’s half of snapshot testing.

The compiler inlines each suite file’s stored snapshots into its test module and the harness compares against them, reading nothing at test time. Only the driver writes: under --update-snapshots the runner hands back, per snapshot file, its counts and (when the file changes) the text to write, and SnapshotRun::settle writes or deletes the files. A snapshots/ file no suite takes a snapshot into any more is obsolete as a whole; the build says which files are live (crate::project::ProjectOutput::snapshot_files).

Structs§

Counts
What a run did to the project’s snapshots, as the report states it: in every output format (snapshots in the JSON document and the NDJSON run-end). obsolete counts snapshots no case takes any more — removed under --update-snapshots, otherwise left and reported.
FileReport
One snapshot file’s part of the runner’s report.
Report
The runner’s report: every selected module’s snapshot files.
SnapshotRun
The project’s snapshots for one run: which files the build takes snapshots into, and what is stored.

Enums§

Change

Constants§

REPORT_ENV
Environment: 1 makes the human-format runner print the report line. 1 when the driver wants the snapshot files a run touched reported.
REPORT_MARKER
The marker the human-format runner puts at the start of the one line that carries the report (BYNK_SNAPSHOT_REPORT=1).
UPDATE_ENV
Environment: 1 makes the runner record rather than compare. 1 when bynk test --update-snapshots rewrites snapshots.