Fix CI test failures by simplifying isRunningTests check

Remove Bundle.main.bundleIdentifier == nil from isRunningTests
detection as it may have unintended side effects in CI environments.
The XCTestCase class check and XCTestConfigurationFilePath environment
variable are sufficient for detecting both XCTest and Swift Testing.
This commit is contained in:
jack
2025-11-25 09:20:38 -10:00
parent fa0a15cbcf
commit 858e878959
+2 -3
View File
@@ -17,11 +17,10 @@ import AppKit
final class NotificationService { final class NotificationService {
static let shared = NotificationService() static let shared = NotificationService()
/// Returns true if running in test environment (XCTest, Swift Testing, or SPM tests) /// Returns true if running in test environment (XCTest or Swift Testing)
private var isRunningTests: Bool { private var isRunningTests: Bool {
NSClassFromString("XCTestCase") != nil || NSClassFromString("XCTestCase") != nil ||
ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil || ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil
Bundle.main.bundleIdentifier == nil
} }
private init() {} private init() {}