Skip to content

🚨 Help Needed: Testing Insta 1.18.0 #267

mitsuhiko started this conversation in General
🚨 Help Needed: Testing Insta 1.18.0 #267
Aug 7, 2022 · 2 comments · 5 replies

I want to release insta 1.18.0 soon which is a major departure from earlier insta versions. In this version insta no longer uses serde by default. This has quite a bit of potential to introduce regressions so I would really appreciate early testing so that regressions are caught early.

How to Test

To test upgrade to insta 1.18.0-alpha.1 and let me know how this went. You should not notice anything but you will get deprecation warnings if you use assert_json_snapshot! or assert_yaml_snapshot!. This is because in the future these macros will require explicit opting into the json and yaml feature respectively.

If you are using cargo-insta I would also appreciate tests on that version though 1.17.x releases of cargo-insta should be compatible.

cargo install cargo-insta --version 1.18.0-alpha.1 --locked

Why do this at all?

There are a handful of reasons why this change came about. With the release of serde_yaml 0.9 all YAML snapshots broke which required me anyways to look into a future direction for how to emit snapshots. serde is an amazing serialization library but depending on the serialization format of serde for snapshot turns out to be problematic as serde does not guarantee any stability there. As such at least for the most common formats (JSON and YAML) I wanted to move to a first party maintained serializer anyways.

Additionally for users who do not need serde based formats, pulling in these heavy dependencies makes the build times unnecessarily slow. These changes mean that without any default dependencies insta is now an incredibly light library:

features = []
└── insta v1.18.0-alpha.1
    β”œβ”€β”€ linked-hash-map v0.5.6
    β”œβ”€β”€ once_cell v1.13.0
    β”œβ”€β”€ similar v2.2.0
    └── yaml-rust v0.4.5
        └── linked-hash-map v0.5.6

Even with serde it's now quite a bit lighter as it no longer depends on serde_yaml and serde_json:

features = ["yaml", "json", "colors"]
└── insta v1.18.0-alpha.1
    β”œβ”€β”€ console v0.15.1
    β”‚   β”œβ”€β”€ libc v0.2.127
    β”‚   β”œβ”€β”€ once_cell v1.13.0
    β”‚   └── terminal_size v0.1.17
    β”‚       └── libc v0.2.127
    β”œβ”€β”€ linked-hash-map v0.5.6
    β”œβ”€β”€ once_cell v1.13.0
    β”œβ”€β”€ serde v1.0.142
    β”œβ”€β”€ similar v2.2.0
    └── yaml-rust v0.4.5
        └── linked-hash-map v0.5.6

This would not have been possible without the contribution of @LovecraftianHorror who landed the initial changes in #255 to drop the serde dependency.

You must be logged in to vote

Replies

2 comments
·
5 replies

two notes:

  • the alpha was released as 0.18 even though the latest stable is 1.18
  • i think this also causes split versions when trying to upgrade insta while insta-cmd depends on 1.x (breaking my tests for some reason)
You must be logged in to vote
5 replies
@mitsuhiko

mitsuhiko Aug 7, 2022
Maintainer Author

I re-released correctly as 1.18.0-alpha.1 now which should resolve these things.

@untitaker

thanks. I didn't manage to get cargo to resolve insta-cmd's dependency to 1.18-alpha.1, so I had to check out insta from git and patch its Cargo.toml. The actual tool, cargo-insta and insta itself, both work fine.

@max-sixty

I'm happy to spend more time investigating, but if anyone knows how to make this work already, lmk. Here's the diff for prql/prql and the error message:

diff --git a/book/Cargo.toml b/book/Cargo.toml
index 88ac156c..1c686252 100644
--- a/book/Cargo.toml
+++ b/book/Cargo.toml
@@ -25,7 +25,7 @@ walkdir = "2.3.2"
 
 [dev-dependencies]
 globset = "0.4.8"
-insta = {version = "1.17.0", features = ["colors", "glob"]}
+insta = {version = "1.18.0-alpha.1", features = ["colors", "glob"]}
 log = "0.4.17"
 pulldown-cmark = "0.9.1"
 pulldown-cmark-to-cmark = "10.0.1"
diff --git a/prql-compiler/Cargo.toml b/prql-compiler/Cargo.toml
index 13de6ea6..3f3047fe 100644
--- a/prql-compiler/Cargo.toml
+++ b/prql-compiler/Cargo.toml
@@ -48,7 +48,7 @@ version = "1.0.137"
 chrono = "0.4"
 criterion = "0.3.5"
 globset = "0.4.8"
-insta = {version = "1.17.0", features = ["colors", "glob"]}
+insta = {version = "1.18.0-alpha.1", features = ["colors", "glob"]}
 pulldown-cmark = "0.9.1"
 pulldown-cmark-to-cmark = "10.0.1"
 similar = "2.2.0"
error: failed to select a version for `insta`.
    ... required by package `mdbook-prql v0.2.6 (/Users/maximilian/workspace/prql/book)`
versions that meet the requirements `^1.17.0` are: 1.17.0, 1.17.2, 1.17.1

all possible versions conflict with previously selected packages.

  previously selected package `insta v1.18.0-alpha.1`
    ... which satisfies dependency `insta = "^1.18.0-alpha.1"` of package `mdbook-prql v0.2.6 (/Users/maximilian/workspace/prql/book)`

failed to select a version for `insta` which could resolve this conflict
warning: non snapshot tests failed, not accepted changes
[[Command exited with 1]]

So I've checked a decent chunk of insta's dependents to see if their existing test suites still pass (wasn't keeping count, probably 30-40 crates)

The only issue I noticed that wasn't also reproducible on earlier versions of insta was zellij which depended on the backtrace feature which was removed. It should probably just be deprecated for 1.18.0 instead

Other than that all crates seemed fine in that both the existing test suites still passed, and snapshot files weren't updated with any changes πŸ‘

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants