You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pulling the snaps on a Windows and running the tests on a Docker (Linux) environment produces the following error:-
--- FAIL: TestFoo (0.01s)
--- FAIL: TestFoo/test_snapshot (0.01s)
foo_test.go:34: snapshot not found
This error is cryptic because suggests that the file doesn't exist when it is actually the wrong format. This can happen when developer clones a repository from Github and attempts to run the tests in a Docker container.
Steps to Reproduce
Go to snapshot folder.
Select a snap
Change the line ending from LF to CRLF on a Windows machine
Attempt to run the tests in a Docker container or some kind of Linux environement
Expected Behavior
Proposal: Update the docs to highlight this issue and maybe change the error message to be less cryptic. i.e.
--- FAIL: TestFoo (0.01s)
--- FAIL: TestFoo/test_snapshot (0.01s)
foo_test.go:34: snapshot not found or wrong format
Proposed changes to docs under notes. (Tried to create a PR but my branch was not accepted):
5. If you are running this package on both a Windows and Linux environment, you may encounter the following error:-
\```bash
--- FAIL: TestFoo (0.01s)
--- FAIL: TestFoo/test_snapshot (0.01s)
foo_test.go:34: snapshot not found
\```
this is because the snapshots are saved with a different line ending on each platform (LF on Linux, CRLF on Windows). To fix this, you can use the [dos2unix](https://pkgs.alpinelinux.org/package/edge/community/x86/dos2unix) tool to convert the line endings to LF on Linux
The text was updated successfully, but these errors were encountered:
Hey 👋 first of all thanks for opening this issue and spending time on this detailed description.
Secondly I would like to know why your pr was not accepted 🤔 If you want to contribute you need to fork the repo, and then create a pull request here with your work. If you did this and didn't work happy to help with this.
As for the issue you mentioned, I can definitely see that when changing a file from LF to CRLF and running the tests it leads to snapshot errors but not on foo_test.go:34: snapshot not found.
As for the LF to CRLF diff errors, I want to spend some time to investigate a bit more on how the library behaves and if it's possible to mitigate or inform the user, else we can add a disclaimer on the docs.
Thanks for reporting the issue. Looks like my handwritten regex could not handle CRLF so it was not able to find snasphots inside the file and was reporting snapshot not found or wrong format. Tell me if now works for you 😄
Description
Pulling the snaps on a Windows and running the tests on a Docker (Linux) environment produces the following error:-
This error is cryptic because suggests that the file doesn't exist when it is actually the wrong format. This can happen when developer clones a repository from Github and attempts to run the tests in a Docker container.
Steps to Reproduce
Expected Behavior
Proposal: Update the docs to highlight this issue and maybe change the error message to be less cryptic. i.e.
Proposed changes to docs under notes. (Tried to create a PR but my branch was not accepted):
The text was updated successfully, but these errors were encountered: