Skip to content

Test fails but review says snapshots are matching #170

@JohnnyMorganz

Description

@JohnnyMorganz

Description

I am using insta for some snapshot testing for a code formatter.
For some tests, I run cargo insta test --review, and accept the new snapshot for the new test.
I then run cargo insta test --review again, and insta picks up on some sort of difference (there shouldn't be any difference), but in the review stage, it says the snapshots are matching (as expected):

Reviewing [1/1]:
Package: stylua (0.4.1)
Snapshot file: tests\snapshots\tests__standard@ignore-comment.lua.snap
Snapshot: standard@ignore-comment
Source: C:\Users\Development\Documents\luafmt
-old snapshot
+new results
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
format(&contents)
────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
          - │ snapshots are matching
────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  a accept   keep the new snapshot
  r reject   keep the old snapshot
  s skip     keep both for now

This causes the test to fail, even though the snapshots are exactly the same.

Sample input file (loaded in through using insta::glob())

-- stylua: ignore
local   bar    =   baz

Output when running the test is equal to the above input file

Corresponding snap file

---
source: tests/tests.rs
expression: format(&contents)

---
-- stylua: ignore
local   bar    =   baz

Additional helpful information:

  • Version of insta: 1.6.3
  • Version of rustc: 1.48.0 (7eac88abb 2020-11-16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions