Skip to content

Conversation

@jerryjrchen
Copy link
Contributor

@jerryjrchen jerryjrchen commented Dec 5, 2025

Create helper to post test events to fallback event handler

As part of the strategy for enabling interoperability, unhandled issues
can be turned into events and sent to the fallback event handler.

Also link against the _TestingInterop framework/library (depending on
the platform), which provides a function to lookup the currently
installed fallback event handler.

@jerryjrchen jerryjrchen added this to the Swift 6.3.0 milestone Dec 5, 2025
@jerryjrchen jerryjrchen self-assigned this Dec 5, 2025
@jerryjrchen jerryjrchen added enhancement New feature or request issue-handling Related to Issue handling within the testing library labels Dec 5, 2025
}

// Encode the event as JSON and pass it to the handler.
let encodeAndInvoke = ABI.CurrentVersion.eventHandler(encodeAsJSONLines: false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to cache this event handler somewhere as there's a bit of runtime overhead to generating it. Remember the fallback event handler can't change after its initial assignment, and will be set by the time an event is generated, so we don't need to worry about it having changed on later calls (i.e. the closure we generate here can permanently capture it.)

@jerryjrchen jerryjrchen force-pushed the send-fallback-events-for-interop branch from 988b54d to 2dd0432 Compare December 10, 2025 23:35
As part of the strategy for enabling interoperability, unhandled issues
can be turned into events and sent to the fallback event handler.

Also link against the _TestingInterop framework/library (depending on
the platform), which provides a function to lookup the currently
installed fallback event handler.
@jerryjrchen jerryjrchen force-pushed the send-fallback-events-for-interop branch from 2dd0432 to 6736ad8 Compare December 10, 2025 23:53
@jerryjrchen jerryjrchen marked this pull request as ready for review December 10, 2025 23:54
@stmontgomery stmontgomery added the interoperability ↔️ Work related to Swift Testing and XCTest interoperability label Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request interoperability ↔️ Work related to Swift Testing and XCTest interoperability issue-handling Related to Issue handling within the testing library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants