Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Enselic
Copy link
Collaborator

@Enselic Enselic commented Aug 11, 2025

So that showing the diff in GitHub does not become more or less unreadable because of faulty syntax highlighting. The .snap file extension can't be changed with insta.

The public-api crate now has (optional) support for built-in snapshot testing that we use instead of insta. But note that the excellent diffing engine of insta (from the crate similar) is still used.

We get two new indirect dev-dependencies:

  • similar-asserts - from the same author as similar and insta, so we can trust it.
  • snapshot-testing - new but tiny and easily audited. (And the author happens to be me.)

If the public_api test fails, instructions on how to update are printed:

thread 'public_api' panicked at tests/public_api.rs:20:16:
assertion failed: `(left == right)`:

help: run with env var `UPDATE_SNAPSHOTS=yes` to update snapshots

...

@Enselic Enselic force-pushed the txt-snapshot branch 2 times, most recently from e51037e to f97ae4d Compare August 11, 2025 15:45
@CosmicHorrorDev
Copy link
Contributor

Looks good from my pov. I like that it's still a snapshot test 🎉

@Enselic
Copy link
Collaborator Author

Enselic commented Aug 20, 2025

Thanks for review! I'll merge after updating snapshot-testing to the latest version in Cargo.lock.

…ta`)

So that showing the diff in GitHub does not become more or less
unreadable because of faulty syntax highlighting.

The `public-api` crate now has (optional) support for built-in snapshot
testing that we use instead of `insta`. But note that the excellent
diffing engine of `insta` (from the crate `similar`) is still used.

We get two new indirect `dev-dependencies`:
* `similar-asserts` - from the same author as `similar` and `insta`, so
 we can trust it.
* `snapshot-testing` - new but tiny and easily auditable. (And the
author happens to be me.)

If the `public_api` test fails, instructions on how to update are printed:

    thread 'public_api' panicked at tests/public_api.rs:20:16:
    assertion failed: `(left == right)`:

    help: run with env var `UPDATE_SNAPSHOTS=yes` to update snapshots

    ...
@Enselic Enselic merged commit 4b26a38 into trishume:master Aug 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants