mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 14:05:18 +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 {
|
||||
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 {
|
||||
NSClassFromString("XCTestCase") != nil ||
|
||||
ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil
|
||||
let env = ProcessInfo.processInfo.environment
|
||||
return NSClassFromString("XCTestCase") != nil ||
|
||||
env["XCTestConfigurationFilePath"] != nil ||
|
||||
env["XCTestBundlePath"] != nil ||
|
||||
env["GITHUB_ACTIONS"] != nil ||
|
||||
env["CI"] != nil
|
||||
}
|
||||
|
||||
private init() {}
|
||||
|
||||
Reference in New Issue
Block a user