4.0: configuration traits and warning severity (W1) - #23
Open
DanielCech wants to merge 1 commit into
Open
DanielCech wants to merge 1 commit into
DanielCech wants to merge 1 commit into
Conversation
- DeallocationConfiguration (timeout, severity) as a task-local default - .deallocationTimeout(_:) and .deallocationIssues(_:) Swift Testing traits for a test or a whole suite; a test's trait wins over its suite's, and an explicit argument wins over both - withDeallocationConfiguration(_:operation:) for XCTest, running on the caller's actor - Warning severity: Issue severity .warning on Swift 6.3+, an intermittent known issue before that, a non-strict expected failure in XCTest - timeout parameters are now optional and default to the configuration Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In the JustFlip proof of concept, 26 call sites passed the same
timeout:because screens with seeded data need longer than the 2 s default. And teams adopting dealloc tests in an existing project need a way to see leaks without failing CI on day one.What's new
DeallocationConfiguration(timeout, severity) is a task-local default that every check uses unless it passes its own value.Precedence: an explicit argument wins over a test's trait, and a test's trait wins over its suite's.
XCTest has no traits, so
withDeallocationConfiguration({ $0.timeout = .seconds(5) }) { … }does the same. It runs on the caller's actor, so it works from@MainActortests; the first version didn't, and the new tests caught that.Warning severity:
severity: .warning;Each issue still goes to exactly one framework, which matters under Swift 6.4's XCTest/Swift Testing interop.
timeoutparameters (expectDeallocation,trackForDeallocation,.checksDeallocation, the DI helper) are nowDuration?with anildefault. This is source compatible.Tests
withDeallocationConfigurationworks, warning severity doesn't fail the test,.checksDeallocationuses the configured timeout.withDeallocationConfigurationchanges the timeout; warning severity doesn't fail the test.🤖 Generated with Claude Code