Snapshot Files

The committed snapshot files will have a header with some meta information that can make debugging easier and the snapshot. The file extension for snapshot files is .snap if they are comitted or .snap.new if they are pending. Header and snapshot are separated by a triple dashes (---). Since the header is YAML itself it also starts with triple dashes (---). This format is similar to front-matter in Markdown.

Example File

---
expression: "vec![1, 2, 3]"
source: tests/test_basic.rs
---
[
    1,
    2,
    3
]

Header Fields

The header of the file is always in YAML format.

The following fields exist in the header:

Snapshot Body

The body is always in whatever format was serialized. This can be YAML, JSON or anything else. Syntax highlighters should be liberal here and assume a variation of YAML and RON.

Newlines

Snapshot files are normalized to unix newlines (LF) before diffing and will always be generated with unix newlines when saving.

Found an issue? You can edit this page on GitHub.