Skip to content

Commit c383628

Browse files
Update default severity in record issue and update isFailure check
1 parent 38a04c0 commit c383628

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Sources/Testing/ABI/EntryPoints/EntryPoint.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
4242

4343
// Set up the event handler.
4444
configuration.eventHandler = { [oldEventHandler = configuration.eventHandler] event, context in
45-
if case let .issueRecorded(issue) = event.kind, !issue.isKnown, issue.severity >= .error {
45+
if case let .issueRecorded(issue) = event.kind, issue.isFailure {
4646
exitCode.withLock { exitCode in
4747
exitCode = EXIT_FAILURE
4848
}

Sources/Testing/Issues/Issue+Recording.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extension Issue {
7373
/// or ``require(_:_:sourceLocation:)-5l63q`` macros.)
7474
@discardableResult public static func record(
7575
_ comment: Comment? = nil,
76-
severity: Severity,
76+
severity: Severity = .error,
7777
sourceLocation: SourceLocation = #_sourceLocation
7878
) -> Self {
7979
let sourceContext = SourceContext(backtrace: .current(), sourceLocation: sourceLocation)
@@ -104,7 +104,7 @@ extension Issue {
104104
@discardableResult public static func record(
105105
_ error: any Error,
106106
_ comment: Comment? = nil,
107-
severity: Severity,
107+
severity: Severity = .error,
108108
sourceLocation: SourceLocation = #_sourceLocation
109109
) -> Self {
110110
let backtrace = Backtrace(forFirstThrowOf: error) ?? Backtrace.current()

Sources/Testing/Issues/Issue.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public struct Issue: Sendable {
104104

105105
/// If the issues is a failing issue.
106106
public var isFailure: Bool {
107-
severity == .error
107+
return !self.isKnown && self.severity >= .error
108108
}
109109

110110
/// Any comments provided by the developer and associated with this issue.

0 commit comments

Comments
 (0)