-
Notifications
You must be signed in to change notification settings - Fork 605
New canGenerateNewSnapshots
to avoid automatically creating missing ones in CI
#768
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
Conversation
Bump? |
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * beta 6 * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix * wip * wip * wip * wip * wip * wip * wip * wip * wip * small things * wip * DocC + swift-format (#765) * DocC and swift-format support * wip * wip * wip --------- Co-authored-by: Brandon Williams <[email protected]>
I had a related idea and stumbled across this searching issues for it. I was looking for a way to record only the snapshots for the failing tests to avoid re-recording all the snapshots in a project. Mainly to avoid unrelated changed being applied and the back and forth of intel/apple silicon shaping out images. This is just an idea, feel free to take or leave it. We could introduce a enum RecordingMode {
/// Only record a snapshot when there isn't an existing one. The default behaviour.
case missingSnapshots
/// Record the snapshots only for failing tests. Useful for when a change affects many
/// snapshots across a project but you don't want the snapshots for the passing tests
/// to be recorded as well.
case failingTests
/// Always record snapshots. The same as setting `isRecording` to true.
case always
/// Never record a snapshot. The same as setting `canGenerateNewSnapshots` to true.
case never
} This could be introduced without being a breaking change by modifying public var isRecording: Bool {
get { recordingMode == .always }
set { recordingMode = newValue ? .always : .missingSnapshot }
} |
Hi @NachoSoto, thanks for the PR! It's taken some time, but this is now implemented in #867. I'm going to merge this PR and then it will be updated to mold into what we have going on in #867. |
Also, @CraigSiemens, #867 adds your option for recording failed snapshots only (see 0c6b449). Thanks for the suggestion! |
… ones in CI (pointfreeco#768) * New `canGenerateNewSnapshots` to avoid automatically creating missing ones in CI Fixes pointfreeco#748. * Update AssertSnapshot.swift
* main: (27 commits) Run swift-format Fix assertSnapshot for Swift Testing tests. (pointfreeco#916) Add an NB to @_implementationOnly import. Run swift-format Import only the implementation of Testing. (pointfreeco#903) fix missing inline snapshot testing (pointfreeco#887) Feature/fixed decimal separator (pointfreeco#889) Run swift-format Xcode 16 beta 5: Fix snapshots test trait (pointfreeco#885) Run swift-format Don't invoke XCTContext when running in the Testing framework. (pointfreeco#884) Run swift-format Fixed .failed record mode in inline snapshots. (pointfreeco#874) Point updated packages to swiftlang organization (pointfreeco#873) Fix recordIssue for Xcode beta 3. (pointfreeco#869) Run swift-format Beta support for Swift Testing, and other improvements. (pointfreeco#867) Run swift-format New `canGenerateNewSnapshots` to avoid automatically creating missing ones in CI (pointfreeco#768) Run swift-format ...
Fixes #748.