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:
@@ -24,7 +24,7 @@ void main() {
|
||||
test('shows a toast for each message published to the toast channel', () async {
|
||||
final (t, bus) = make();
|
||||
publishToast(bus, 'builtin.git', 'Pushed to origin/main', severity: ToastSeverity.success, duration: Duration.zero);
|
||||
await Future<void>.delayed(Duration.zero); // let the broadcast stream deliver
|
||||
await pumpEventQueue(); // let the broadcast stream deliver
|
||||
expect(t.entries.single.message, 'Pushed to origin/main');
|
||||
expect(t.entries.single.severity, ToastSeverity.success);
|
||||
});
|
||||
@@ -33,7 +33,7 @@ void main() {
|
||||
final (t, bus) = make();
|
||||
bus.publish('x', toastChannel, {'severity': 'error'}); // no message
|
||||
bus.publish('x', 'other-channel', {'message': 'nope'}); // wrong channel
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(t.entries, isEmpty);
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
final (t, bus) = make();
|
||||
bus.publish('x', toastChannel, {'message': 'a', 'severity': 'warning', 'durationMs': 0});
|
||||
bus.publish('x', toastChannel, {'message': 'b', 'severity': 'bogus', 'durationMs': 0});
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(t.entries.map((e) => e.severity), [ToastSeverity.warning, ToastSeverity.info]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user