Description
Initially caught while trying to test preconditions in exit tests in release mode, it was identified that the barrier value was being presented in standardErrorContent when it shouldn't have been.
Reproduction
import Testing
@Test func example() async throws {
let result = await #expect(processExitsWith: .failure, observing: [\.standardErrorContent]) {
preconditionFailure("Oh no")
}
#expect(String(String(decoding: result?.standardErrorContent ?? [], as: UTF8.self)) == "ReleaseExitTestTests/ReleaseExitTestTests.swift:4: Fatal error: Oh no\n")
}
// `swift test` succeeds!
// `swift test -c release` fails :(
Expected behavior
swift test -c release does not produce the barrier value, though it should still fail as preconditionFailure() doesn't output in release mode.
Environment
% swift test
Testing Library Version: 1743
Target Platform: arm64e-apple-macos14.0
% swift --version
swift-driver version: 1.148.6 Apple Swift version 6.3.1 (swiftlang-6.3.1.1.2 clang-2100.0.123.102)
Target: arm64-apple-macosx26.0
% uname -a
Darwin DimitriM5MaxMBP.home.bouniol.me 25.4.0 Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:50 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T6050 arm64
Additional information
Description
Initially caught while trying to test preconditions in exit tests in release mode, it was identified that the barrier value was being presented in
standardErrorContentwhen it shouldn't have been.Reproduction
Expected behavior
swift test -c releasedoes not produce the barrier value, though it should still fail aspreconditionFailure()doesn't output in release mode.Environment
Additional information