We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
_XCTIsTesting
1 parent fa6e1d2 commit 046aba2Copy full SHA for 046aba2
Sources/XCTestDynamicOverlay/XCTIsTesting.swift
@@ -1,9 +1,9 @@
1
import Foundation
2
3
public let _XCTIsTesting: Bool = {
4
- guard let path = ProcessInfo.processInfo.arguments.first
5
- else { return false }
6
-
7
- let url = URL(fileURLWithPath: path)
8
- return url.lastPathComponent == "xctest" || url.pathExtension == "xctest"
+ ProcessInfo.processInfo.environment.keys.contains("XCTestSessionIdentifier")
+ || ProcessInfo.processInfo.arguments.first
+ .flatMap(URL.init(fileURLWithPath:))
+ .map { $0.lastPathComponent == "xctest" || $0.pathExtension == "xctest" }
+ ?? false
9
}()
0 commit comments