Skip to content

Upgrading insta 0.16 to 1

Breaking0.16.1 → 1.49.0Breaking10Platform6Deprecated7New66Changed72Fixed76Other13

BreakingUpgrade verdict

10 breaking changes and 6 platform requirement changes.

  • To keep using JSON or YAML snapshot assertions, you must now enable the matching feature.
  • The force-update flag now rewrites all snapshots and accepts them, so inline snapshot delimiters and indentation get updated too. To keep the old behavior, use the new --require-full-match flag.
  • The command line flag for including ignored tests has a new name, so scripts using the old name must be updated.
  • The optional backtrace support has been removed from the package.
Top 5 of 23 that need code or config changes

Requires Rust 1.66.0 from 1.47.0 (none stated before).

Breaking10
assert_json_snapshot! and assert_yaml_snapshot! now require the json and yaml features respectively.
assert_json_snapshot!assert_yaml_snapshot!jsonyaml
Changes --force-update-snapshots to write every snapshot and imply --accept; use --require-full-match for the old behavior.
--force-update-snapshots--accept--require-full-match
Renames the --no-ignore option to --include-ignored.
--no-ignore--include-ignored
Removes the backtrace feature.
backtrace
Removes the serialization feature.
serialization
Removes deprecated Settings::bind_to_thread.
Settings::bind_to_thread
Disallows unnamed snapshots in doctests.
Changes snapshot name detection to use function names instead of thread names, altering snapshot names in some cases.
Adds Send + Sync bounds to the Comparator trait for consistency with Arc-based storage.
Comparator
insta::internals::SettingsBindDropGuard returned from Settings::bind_to_scope no longer implements Send.
insta::internals::SettingsBindDropGuardSettings::bind_to_scopeSend
Platform6
Upgrades console to 0.16 and raises the minimum supported Rust version (MSRV) to 1.66.
console
Raises the MSRV for insta to 1.60 and for cargo-insta to 1.64.
instacargo-insta
Bumps the minimum supported Rust version to 1.56.1 because the serde-yaml dependency no longer supports older Rust versions.
Bumps libc to 0.2.174, fixing musl builds, and raises the MSRV of insta to 1.64.0.
libc
Lowers the minimum supported Rust version to 1.41.0.
Bumps the similar dependency to reintroduce support for Rust 1.43.0.
Deprecated7
Adds a --disable-nextest-doctest flag together with a deprecation warning.
--disable-nextest-doctest
Hides the unseen CLI option, which is pending deprecation.
unseen
Deprecates --no-force-pass in cargo-insta in favor of the clearer --check option.
--no-force-pass--check
Deprecates the INSTA_FORCE_UPDATE_SNAPSHOTS env var in favor of INSTA_FORCE_UPDATE.
INSTA_FORCE_UPDATE_SNAPSHOTSINSTA_FORCE_UPDATE
Deprecates the assert_display_snapshot! macro.
assert_display_snapshot!
Deprecates unused serialization features.
serialization
Deprecates unused backtrace feature.
backtrace