diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index bcdce61a05..695ce7e238 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -499,7 +499,14 @@ impl TestAppContext { Fut: 'static + Future, T: 'static, { - self.cx.borrow_mut().spawn(f) + let foreground = self.foreground(); + let future = f(self.to_async()); + let cx = self.to_async(); + foreground.spawn(async move { + let result = future.await; + cx.0.borrow_mut().flush_effects(); + result + }) } pub fn simulate_new_path_selection(&self, result: impl FnOnce(PathBuf) -> Option) {