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

bacon test with something like insta can endlessly trigger re-runs #138

Open
CosmicHorrorDev opened this issue Jun 12, 2023 · 5 comments
Open

Comments

@CosmicHorrorDev
Copy link

insta will create a new snapshot file when a snapshot test fails that is used for the next run of cargo insta review. insta creating this file on failure does mean that bacon test can get stuck in a loop of:

  1. bacon test runs the test suite
  2. A snapshot test fails creating a new pending file for review
  3. The new file triggers a re-run (return to step 2.)

For possible solutions I was thinking either allowing for excluding files from the file watcher by glob, or allowing for a debouncing period. I'm personally leaning towards the former since having to deal with a debouncing period would be annoying for my workflow when dealing with projects that have longer compile/test times

I'd be willing to make a PR if you think that this would be a worthwhile addition

@Canop
Copy link
Owner

Canop commented Jun 13, 2023

If your project sources are controlled with git, you shouldn't have any problem:
I don't know insta but the file it creates, being automatically generated from sources, should probably be ignored, and changes on gitignored files don't trigger bacon runs.

Are you using another source version control system than git ?

@CosmicHorrorDev
Copy link
Author

No, but the snapshots should not be ignored. The snapshot files are the source of truth for snapshot tests. You can essentially think of their contents as the expected value in an assert_eq!()

@CosmicHorrorDev
Copy link
Author

CosmicHorrorDev commented Jun 13, 2023

I guess I could setup git to ignore the pending snapshots, but I kind of rely on pending snapshots to show up in git status to notice that I forgot to review

I can't recall a project that uses insta and ignores pending snapshots, but I also don't make a habit of checking .gitignore files. It could be a workable solution I suppose

Edit: I'll go ahead and give it a try :)

I'll re-open if I end up running into any issues with the different workflow

@Canop
Copy link
Owner

Canop commented Jun 13, 2023

I wasn't asking you to close the issue, you can keep it open until everybody thinks it's OK.
For once, git shouldn't be a requirement to use bacon.

@GeeWee
Copy link

GeeWee commented Jun 20, 2023

I occasionally get this as well, even though my pending snapshot files are under .gitignore for some reason.

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

No branches or pull requests

3 participants