Skip to content

Commit db570ca

Browse files
committed
wip
1 parent 3d4e63e commit db570ca

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Sources/IssueReporting/IsTesting.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@
2323
/// }
2424
///
2525
/// To detect if the current task is running inside a test, use ``TestContext/current``, instead.
26-
public let isTesting = ProcessInfo.processInfo.isTesting // TODO: || TestContext.current != nil
26+
public let isTesting = ProcessInfo.processInfo.isTesting
2727

2828
private extension ProcessInfo {
2929
var isTesting: Bool {
3030
if environment.keys.contains("XCTestBundlePath") { return true }
3131
if environment.keys.contains("XCTestConfigurationFilePath") { return true }
3232
if environment.keys.contains("XCTestSessionIdentifier") { return true }
33-
if let argument = arguments.first {
33+
return arguments.contains { argument in
3434
let path = URL(fileURLWithPath: argument)
35-
if path.lastPathComponent == "xctest" { return true }
35+
return path.lastPathComponent == "xctest" || path.pathExtension == "xctest"
3636
}
37-
if let argument = arguments.last {
38-
let path = URL(fileURLWithPath: argument)
39-
if path.pathExtension == "xctest" { return true }
40-
}
41-
return false
4237
}
4338
}
4439
#endif

0 commit comments

Comments
 (0)