mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 20:45:19 +00:00
Add CI environment detection to isRunningTests
Add checks for GITHUB_ACTIONS, CI, and XCTestBundlePath environment variables to reliably detect test/CI environments where notification APIs should be skipped.
This commit is contained in:
@@ -17,10 +17,14 @@ import AppKit
|
|||||||
final class NotificationService {
|
final class NotificationService {
|
||||||
static let shared = NotificationService()
|
static let shared = NotificationService()
|
||||||
|
|
||||||
/// Returns true if running in test environment (XCTest or Swift Testing)
|
/// Returns true if running in test environment (XCTest, Swift Testing, or CI)
|
||||||
private var isRunningTests: Bool {
|
private var isRunningTests: Bool {
|
||||||
NSClassFromString("XCTestCase") != nil ||
|
let env = ProcessInfo.processInfo.environment
|
||||||
ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil
|
return NSClassFromString("XCTestCase") != nil ||
|
||||||
|
env["XCTestConfigurationFilePath"] != nil ||
|
||||||
|
env["XCTestBundlePath"] != nil ||
|
||||||
|
env["GITHUB_ACTIONS"] != nil ||
|
||||||
|
env["CI"] != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
private init() {}
|
private init() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user