Quick / Nimble

A Matcher Framework for Swift and Objective-C
https://quick.github.io/Nimble/documentation/nimble/
Apache License 2.0
4.81k stars 598 forks source link

Ensure that stringify'ing an expression as part of the async/await polling infrastructure always happens on the main thread #1024

Closed younata closed 1 year ago

younata commented 1 year ago

Whenever you trip the main thread checker in test, it outputs a backtrace of what called what to lead to the main thread checker being tripped. A bunch of test result parsers treat any backtrace information as a test crash, even though the test isn't actually crashing.

This prevents Nimble from accidentally tripping the main thread checking when stringifying the expression being checked in the async/await version of toEventually, by forcing that particular function to run on the main actor.

In a smoke test, I found that this does work, and I didn't notice any issues with doing this.