From d2edb651c1cf647fe5f370e971b0f1adc7b868aa Mon Sep 17 00:00:00 2001 From: jack Date: Tue, 25 Nov 2025 09:29:26 -1000 Subject: [PATCH] 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. --- bitchat/Services/NotificationService.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bitchat/Services/NotificationService.swift b/bitchat/Services/NotificationService.swift index c6790e80..e55f7777 100644 --- a/bitchat/Services/NotificationService.swift +++ b/bitchat/Services/NotificationService.swift @@ -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() {}