Starting from Xcode 12.4 (I think), failing unit tests in framework targets take about 5 seconds to complete. Successful tests complete almost instantly (as expected).
For example, the following test:
func testExampleFailure() {
XCTFail()
}
Takes 4.356 seconds to execute on my 2019 MacBook Pro:
Test Case '-[FrameworkTests.FrameworkTests testExampleFailure]' failed (4.356 seconds).
This seems to only affect unit tests in Framework targets (unit tests for App targets are unaffected). I have also tested this in fresh Framework template projects across multiple Macs, so it appears to be an Xcode bug.
I'd hoped Xcode 13 would fix this issue, but it persists for me on Monterey. Perhaps someone could suggest a workaround?