Unit tests crash with Xcode 12.5 + Big Sur
jessesquires opened this issue · 1 comments
Problem
For some reason, unit tests just crash on Xcode 12.5+ during StatusItemController.init
:
self.statusItem = NSStatusBar.system.statusItem(withLength: length)
The issue is with NSStatusBar.system
🤷🏼
EDIT: The issue seems to be with Big Sur. Crashes also occur with Xcode 12.4 on Big Sur...
Example logs
https://github.com/hexedbits/StatusItemController/runs/3064104921?check_suite_focus=true
Workaround
Using Xcode 12.4 and macOS 10.15 for now — only for ci.yml
See: #14
Notes
No idea why this is happening. See like an AppKit bug or something?
It looks like system behavior changed in BigSur and NSStatusBar.system.statusItem()
implements a new assert when called outside of an app context.
The fix here is to embed the framework in an app target, and run tests on the example app.
In other words, we need a separate test harness and cannot test the framework directly.
This would kind of be like trying to test a window-less view controller -- although that does not hit an assert, but I can see how attempting to create a status item without an app is an invalid state, thus the new assert.