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:
@@ -34,36 +34,36 @@ void main() {
|
||||
test('editor.opened opens the editor split', () async {
|
||||
expect(f.services.arrangement.editorOpen, isFalse);
|
||||
emitEditor('editor.opened', id: 'b_1');
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isTrue);
|
||||
});
|
||||
|
||||
test('editor.active-changed with a buffer keeps the split open', () async {
|
||||
emitEditor('editor.active-changed', id: 'b_2');
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isTrue);
|
||||
});
|
||||
|
||||
test('editor.active-changed with a null id collapses the split', () async {
|
||||
emitEditor('editor.opened', id: 'b_1');
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isTrue);
|
||||
|
||||
emitEditor('editor.active-changed', id: null);
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isFalse);
|
||||
});
|
||||
|
||||
test('a non-editor event does not open the split', () async {
|
||||
f.services.events.emit(DaemonEvent(subsystem: 'git', kind: 'changed', data: const {}, ts: DateTime.now().toUtc()));
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isFalse);
|
||||
});
|
||||
|
||||
test('after deactivate, editor events no longer open the split', () async {
|
||||
await f.services.extensions.deactivate('builtin.editor');
|
||||
emitEditor('editor.opened', id: 'b_9');
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
await pumpEventQueue();
|
||||
expect(f.services.arrangement.editorOpen, isFalse);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user