You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the current configuration to Event.Context. (#677)
This PR adds a `var configuration: Configuration` property to
`Event.Context` and adds a `verbosity` property to `Configuration`. We
solve two problems:
1. An event handler cannot see the current configuration (without
querying `Configuration.current`) which limits its ability to customize
its behaviour; and
2. The verbosity of human-readable output is tracked by individual event
handlers when it is intended to be part of a test run's configuration.
Since the configuration contains the event handler to which we pass the
event context, the `eventHandler` property of the context is cleared
before the event handler is called (thus breaking any reference cycles.)
Callers of the internal `Event.post()` function are now required to
either pass _both_ the test and test case for the event, or to pass
neither (in which case we now gather both from the runtime state in a
single call rather than hitting the task-local twice.) This is effected
with a tuple as an argument to `Event.post()` which is admittedly a bit
wonky but does force our call sites to explicitly pass values for both
the test and test case, where previously we could accidentally pass a
specific test and then go look up the task-local current test case
(which should have been `nil` in all the cases where we were doing this
anyway.)
A couple of interfaces on the event recorder types have changed in this
PR in source-breaking ways. The old interfaces remain present but
deprecated; they will be removed later in the Swift 6.1 development
cycle after tools authors have had time to migrate.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments