mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Refactor LoggingTests utilising Rust's new ability to redirect log files at runtime. (#4353)
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
import SwiftUI
|
||||
|
||||
class UnitTestsAppCoordinator: AppCoordinatorProtocol {
|
||||
private let targetConfiguration: Target.ConfigurationResult
|
||||
static let targetRageshakeURL = RemotePreference<RageshakeConfiguration>(.url("bugs.example.com/submit"))
|
||||
static let targetAppHooks = AppHooks()
|
||||
|
||||
let windowManager: SecureWindowManagerProtocol
|
||||
|
||||
init(appDelegate: AppDelegate) {
|
||||
@@ -23,6 +27,17 @@ class UnitTestsAppCoordinator: AppCoordinatorProtocol {
|
||||
analyticsClient.isRunning = false
|
||||
ServiceLocator.shared.register(analytics: AnalyticsService(client: analyticsClient,
|
||||
appSettings: ServiceLocator.shared.settings))
|
||||
|
||||
// As the tests take advantage of Rust's ability to redirect the log files, there is
|
||||
// often some debris left from the previous run, so we wipe the entire directory.
|
||||
// This is an NOT an advised way to delete logs in production, `Tracing.deleteLogFiles`
|
||||
// exists for that purpose.
|
||||
try? FileManager.default.removeItem(at: .appGroupLogsDirectory)
|
||||
targetConfiguration = Target.tests.configure(logLevel: .info,
|
||||
traceLogPacks: [],
|
||||
sentryURL: nil,
|
||||
rageshakeURL: Self.targetRageshakeURL,
|
||||
appHooks: Self.targetAppHooks)
|
||||
}
|
||||
|
||||
func start() { }
|
||||
|
||||
Reference in New Issue
Block a user