Closed kenmaz closed 4 years ago
you can use this code instead of just checking if you are on macosx 10.13
if #available(OSX 10.13, *) {
testCase.recordFailure(withDescription: "\(name): \(failure.reason)", inFile: failure.file, atLine: failure.line, expected: false)
} else {
let location = XCTSourceCodeLocation(filePath: failure.file, lineNumber: failure.line)
let issue = XCTIssue(type: .assertionFailure, compactDescription: "\(name): \(failure.reason)", detailedDescription: nil, sourceCodeContext: .init(location: location), associatedError: nil, attachments: [])
testCase.record(issue)
}
please it's very important to merge this pr and create a new release, because some project needed to run on Xcode 12 and on macOS Big Sur like XcodeGen
Hey @kylef - any word?
These changes would render Spectre test failures as successes with the Xcode reporter in many cases. This change won't be accepted in its current state, this must be fixed before this change can be considered.
XCTestCase.recordFailure(..)
method has been deprecated on Xcode12+ and it will cause compile error on Xcode12.To avoid that, added
@available
block. In the future,XCTestCase. recordFailure(..)
should be replaced with new API,XCTestCase.record(_:)
.Video https://developer.apple.com/videos/play/wwdc2020/10687/ Document https://developer.apple.com/documentation/xctest/xctestcase/3546549-record