Skip to content

Configure isRecording default value with launch argument #862

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

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

tgrapperon
Copy link
Contributor

We often want to reset all the snapshots during development of foundational/utility domains that may invalidate many snapshots in many files, and it is currently inconvenient to search and flip flags for these tests.

This PR exposes a launch argument that allows to seed the default of isRecording by passing -co.pointfree.SnapshotTesting.IsRecording 1. It is very convenient to have a dedicated scheme (or to use the checkbox) to regenerate all snapshots in a project. This only sets the default value, so it shouldn't affect local isRecording overrides.

The naming is inspired from the various arguments Apple provides for CoreData, like -com.apple.CoreData.SQLDebug 1 (See here, "Debugging Fetching"). It can of course be discussed.

This is fairly additional. Some users have reported more or less involved workarounds (like using subclasses of XCTestCase, or CI scripts), but this solution would make this problem much easier to solve IMO.

@tgrapperon tgrapperon changed the title Configure isRecording default value with launch arguments Configure isRecording default value with launch argument Jul 1, 2024
Copy link
Member

@stephencelis stephencelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Going to merge as is but will rework in a follow-up PR to use an environment variable instead. Slightly easier to configure for test targets and we think the KEY=VALUE syntax is a bit friendlier than Apple's convention, and more common in the open source community.

@stephencelis stephencelis merged commit 172f441 into pointfreeco:main Jul 4, 2024
awaltzforvenus pushed a commit to oreillymedia/native-ios-swift-snapshot-testing that referenced this pull request Jul 30, 2024
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