Repository navigation
fix(tests): isolate the test host's prefs and real-install side effects - #518
Merged
Merged
Conversation
A test host launches with the shipping bundle id, so UserDefaults.standard was the user's real domain, and Debug/test runs answered the Move to Applications alert and registered login items. Preferences and every default-arg store now go through AppDefaults.store: a dedicated suite wiped at first use under XCTest, standard otherwise. A test host also skips Sparkle, the move and migration offers, the macOS 27 notice and status item autosave. Opt back in with AppDefaults.sideEffectsOptIn or HIDDEN_BAR_TEST_HOST_SIDE_EFFECTS=1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Test hosts launch with the shipping bundle id, so
UserDefaults.standardwas the user's realcom.dwarvesv.minimalbardomain. This routes all preferences throughAppDefaults.store: the dedicated suitecom.dwarvesv.minimalbar.tests(wiped at first use) under XCTest,.standardotherwise.A test host also skips Sparkle (updater not started, its key kept in the suite), the Move to Applications and App Store migration offers, the macOS 27 notice, and status item autosave names (macOS persists those in the real domain). Login items and the second-copy quit were already skipped. Opt back in with
AppDefaults.sideEffectsOptInorHIDDEN_BAR_TEST_HOST_SIDE_EFFECTS=1. Shipping behavior is unchanged.Test
HiddenTests/PrefsIsolationTests.swiftwrites prefs and asserts the real domain (read via CFPreferences, never written) is identical before and after, plus the store, wipe and side-effect policy.Run in the mac-ui VM with
scripts/test.sh: Direct 659 passed, App Store 437 passed, 0 failed. Negative control (store forced to.standard): 2 isolation tests fail, including the real-domain delta.