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

Reuse count for repeated tests #18

Merged
merged 1 commit into from
Feb 25, 2025
Merged

Reuse count for repeated tests #18

merged 1 commit into from
Feb 25, 2025

Conversation

tahirmt
Copy link
Owner

@tahirmt tahirmt commented Feb 25, 2025

Currently if you have more than one expectation in a test and you run that test repeatedly the snapshots would get generated over and over with different identifier.

it("should look as expected) {
  expect(view1) == snapshot(as: .image)
  expect(view2) == snapshot(as: .image)
}

If you run the test above repeatedly you will see new images with 3-n index getting added. This causes a lot of problems for repeated tests and generates unnecessary snapshots.

Now, we will reuse the counter value for the same expectation on the same line for every repetition and this allows you to run tests repeatedly without issues.

@tahirmt tahirmt merged commit 974d70f into main Feb 25, 2025
1 check passed
@tahirmt tahirmt deleted the allow-repeated-tests branch February 25, 2025 21:03
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