Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insta complains falsy assertion failure if the text snapshot starts with ---\n #688

Open
Myriad-Dreamin opened this issue Nov 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Myriad-Dreamin
Copy link

What happened?

I'm encountering Myriad-Dreamin/tinymist#868 in insta 1.41.1. In short, the issue reports that insta complains assertion failures on nixpkgs's build targets {x86_64,aarch64}-{linux,darwin}. After debug for a while, I suspect it is because some of my text snapshots start with ---\n, as shown in Myriad-Dreamin/tinymist#903. However, I'm not 100% confident on my judgement because I cannot trigger the failure on my local PC ({x86_64}-{windows,linux}). Could you help me?

Some build log containing such failures: https://build.alpinelinux.org/buildlogs/build-edge-x86_64/testing/tinymist/tinymist-0.12.2-r1.log

Reproduction steps

running cargo test might trigger the falsy assertion failure.

Insta Version

1.41.1

rustc Version

1.82

What did you expect?

I expect to pass all tests.

@Myriad-Dreamin Myriad-Dreamin added the bug Something isn't working label Nov 26, 2024
@Myriad-Dreamin Myriad-Dreamin changed the title insta complains falsy assertion failure if the text snapshot starts with --- insta complains falsy assertion failure if the text snapshot starts with ---\n Nov 26, 2024
@max-sixty
Copy link
Collaborator

Yes, it's possible with that exact string that we'd see odd behavior, since we strip it.

Do you have a minimal reproduction?

@max-sixty
Copy link
Collaborator

I also don't see test failures in the log you linked to? I see some warnings about legacy snapshots — which is very much expected on inline snapshots starting with ---\n (insta's behavior used to be inconsistent between file & inline snapshots there).

I will prioritize if we can find a case of inconsistency / backward-compat issues!

@Myriad-Dreamin
Copy link
Author

Hello, after investigation, I believe the assertion failures are caused by other reason. It is just causing falsy warnings. This should be the same conclusion as yours.

A minimum example of creating falsy warning might be creating a snapshot with content "---\ntest". Note: on windows, they might insert an \r implicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants