test: deflake the suite — pumpEventQueue instead of Future.delayed(Duration.zero)

~173 `await Future<void>.delayed(Duration.zero)` async-settle waits across 25
test files yield the microtask queue exactly once; when an event→handler chain
needs more than one hop they lose the race under CI's parallel load, so the
failing set varied run to run. Replace with `await pumpEventQueue()` (the
deterministic drain already used elsewhere in the suite); rewired the shared
settle()/tick() helpers in one shot. menu_bar's toggle-close test gets a bounded
extra pump. Verified green under CI=true.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-14 23:13:13 +02:00
co-authored by Claude Opus 4.8
parent 3dce5c614d
commit e55b4a9173
26 changed files with 175 additions and 174 deletions
+4 -4
View File
@@ -54,7 +54,7 @@ void main() {
expect(c.focusPath, 'lib/b.dart');
expect(notified, greaterThan(0));
// focus() reloads so the latest edits to that file are present.
await Future<void>.delayed(Duration.zero);
await pumpEventQueue();
expect(diffCalls, greaterThan(before));
});
@@ -62,13 +62,13 @@ void main() {
c.focus('lib/gone.dart');
expect(c.focusPath, 'lib/gone.dart');
// The reload triggered by focus() returns a list without that file.
await Future<void>.delayed(Duration.zero);
await pumpEventQueue();
expect(c.focusPath, isNull);
});
test('a focus that stays in the diff survives reload', () async {
c.focus('lib/a.dart');
await Future<void>.delayed(Duration.zero);
await pumpEventQueue();
expect(c.focusPath, 'lib/a.dart');
});
@@ -76,7 +76,7 @@ void main() {
await c.load();
final before = diffCalls;
bus.emit(DaemonEvent(subsystem: 'git', kind: 'git.changed', data: const {}, ts: DateTime.now().toUtc()));
await Future<void>.delayed(Duration.zero);
await pumpEventQueue();
expect(diffCalls, greaterThan(before));
});