All notable changes to insta and cargo-insta are documented here.
- Added
--no-quiet
/-Q
flag tocargo insta test
to suppress the quiet flag. This works around limitations with custom test harnesses such as cucumber. - Update RON to 0.7.1.
- Added improved support for running insta from doctests. (#243)
- Bump minimum version of Rust to 1.56.1. This was done because the used serde-yaml dependency no longer supports older versions of Rust.
- Update uuid crate to 1.0.0. (#228)
- Use inline block format also for strings of form
"foo\n"
. (#225)
- Fixed a bug that caused insta to panic if inline snapshot assertions moved since the time of the snapshot creation. (#220)
cargo insta test
now returns non zero status code when snapshots are left for review. (#222)- Assertion failures now mention
cargo insta test
. (#223)
- Fixed a bug where an extra newline was emitted following the snapshot header.
assertion_line
is no longer retained in snapshots. (#218)
- Add support for sorting redactions (
sorted_redaction
andSettings::sort_selector
). (#212) - Changed snapshot name detection to no longer use thread names but function names. (#213)
Upgrade Notes:
Insta used to detect the current test name by using the current thread name. This appeared to work well but unfortunatley ran into various limitations. In particular in some cases the thread name was truncated, missing or did not point to the current test name. To better support different platforms and situations insta now uses the function name instead.
This however changes behavior. In particular if you are using a helper function to assert, a different snapshot name will now be used. You can work around this issue by using a helper macro instead or to explicitly pass a snapshot name in such situations.
- Trim down some unnecessary dependencies and switch to
once_cell
. (#208)
- Update internal dependencies for console and ron.
cargo-insta
now correctly handles the package (-p
) argument ontest
when deleting unreferenced snapshots. (#201)
- Added the ability to redact into a key. (#192)
- Insta now memorizes assertion line numbers in snapshots. While these
will quickly be old, they are often useful when reviewing snapshots
immediately after creation with
cargo-insta
. (#191)
- Fixed an issue where selectors could not start with underscore. (#189)
- Allow passing arguments to
cargo test
. (#183) - Avoid the use of
Box::leak
. (#185) - When
INSTA_WORKSPACE_ROOT
is set, the value is used as the manifest directory rather than whateverCARGO_MANIFEST_DIR
was set to at compile time. (#180)
- Removed an accidental debug print. (#175)
- Added support for u128/i128. (#169)
- Normalize newlines to unix before before asserting. (#172)
- Switch diffing to patience. (#173)
- Fix a bug with empty lines in inline snapshots. (#166)
- Lower Rust support to 1.41.0 (#165)
- Bump similar dependency to reintroduce support for Rust 1.43.0 (#162)
- Fixed custom extension support in cargo-insta (#163)
- Change CSV serialization format to format multiple structs as multiple rows. (#156)
- Improvements to diff rendering.
- Detect some snapshot name clashes. (#159)
- Replace difference with similar.
- API documentation updates.
- Fixed glob not working correctly.
- Fail by default if glob is not returning any matches. Fixes #151.
- Add
pending-snapshots
parameter tocargo-insta
. cargo-insta
now honors ignore files. This can be overridden with--no-ignore
.cargo-insta
now supports the vscode extension.
- Add
--delete-unreferenced-snapshots
parameter tocargo-insta
. - Switch to the
globset
crate for theglob
feature. - When
INSTA_UPDATE
is set toalways
orunseen
it won't fail on execution. - Changed informational outputs also show on pass.
- Expose more useful methods from
Content
. - Fixes for latest rustc version.
- Fix invalid offset calculation for inline snapshot (#137)
- Added support for newtype variant redactions. (#139)
- Added the
INSTA_SNAPSHOT_REFERENCES_FILE
environment variable to support deletions of unreferenced snapshot files. (#136) - Added support for TOML serializations.
- Avoid diff calculation on large input files. (#135)
- Added
prepend_module_to_snapshot
flag to disable prepending of module names to snapshot files. (#133) - Made
console
dependency optional. Thecolors
feature can be disabled now which disables colored output.
- Globs now follow links (#132)
- Added CSV Support (#134)
- Changed globs to also include directories not just files.
- Support snapshots outside source folder. (#70)
- Update RON to 0.6.
- Add
Settings::bind_async
when theasync
feature is enabled. (#121) - Bumped
console
dependency to 0.11. (#124) - Fixed incorrect path handling for
glob!
. (#123) - Remove
cargo-insta
from workspace and addCargo.lock
. (#116)
- Made snapshot names optional for inline snapshots. (#106)
- Remove legacy macros. (#115)
- Made small improvements to cargo-insta's messaging and flags (#114)
- Added new logo.
- Added
glob
support. (#112) - Made
MetaData
fields internal. (#111)
- Added test output control (
INSTA_OUTPUT
envvar). (#103)
- Dependency bump for
console
(lowers total dependency count) - Change binary name to
cargo insta
in help pages.
- Added support for
INSTA_UPDATE=unseen
to write out unseen snapshots without review (#96) - Added the
backtrace
feature which adds support for test name (and thus snapshot name) recovery from the backtrace if rust-test is not used in concurrent mode (#94, #98)
- Add support for deep wildcard matches (#92)
- Use module paths for test names (#87)
- Do not emit useless indentations for empty lines (#88)
- Improve redactions support (#81)
- Deprecated macros are now hidden
- Reduce number of dependencies further.
- Added support for newtype struct redactions.
- Fixed bugs with recursive content operations (#80)
- redactions are now an optional feature that must be turned on to be used (
redactions
). - RON format is now an optional feature that must be turned on to be used (
ron
). - added support for sorting maps before serialization.
- added settings support.
- added support for overriding the snapshot path.
- correctly handle nested macros that might contain inline snapshots.
- use thread name as snapshot name for inline snapshots.
- use leading whitespace normalization for inline snapshots.
- removed
creator
andcreated
field from snapshot metadata. - removed the
_matches
suffix from all macros. - added an
--accept
option tocargo insta test
- added
--force-update-snapshots
option tocargo insta test
- added
--jobs
and--release
argument tocargo insta test
.
To upgrade to the new insta macros and snapshot formats you can use
fastmod
and cargo-insta
together:
$ cargo install fastmod
$ cargo install cargo-insta
$ fastmod '\bassert_([a-z]+_snapshot)_matches!' 'assert_${`}!' -e rs --accept-all
$ cargo insta test --all --force-update-snapshots --accept