share a generous test I/O timeout constant
test / unit + widget + golden + a11y (push) Failing after 26s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 23s

The flaky-gate fixes kept hand-tuning magic seconds in each real-I/O
test. Pull them into one Flutter-free constant — ioTimeout (20s) in
test/helpers/timeouts.dart, importable by both the dart-test (pty) and
flutter-test suites — and route the real-external-wait timeouts through
it: PTY output (session + registry), and fs-watcher events (timeout +
poll ceiling). Tune in one place instead of scattering durations.

The ipc socket round-trip timeouts (2s) are left as-is — they haven't
flaked and local sockets respond in ms; they can adopt the constant
later if needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 10:41:17 +02:00
co-authored by Claude Opus 4.7
parent b0d5aa36f4
commit 9590f555c9
4 changed files with 31 additions and 15 deletions
+8 -6
View File
@@ -8,6 +8,8 @@ import 'package:clide/src/files/ignore.dart';
import 'package:clide/src/files/watcher.dart';
import 'package:test/test.dart';
import '../helpers/timeouts.dart';
void main() {
group('FileChangeKind', () {
test('fromEvent maps every FileSystemEvent.type to a wire kind', () {
@@ -69,8 +71,8 @@ void main() {
);
await File('${sandbox.path}/new.txt').writeAsString('hi');
final change = await saw.timeout(
const Duration(seconds: 5),
onTimeout: () => fail('no `new.txt` event within 5s'),
ioTimeout,
onTimeout: () => fail('no `new.txt` event within ${ioTimeout.inSeconds}s'),
);
expect(change.path, 'new.txt');
});
@@ -115,13 +117,13 @@ void main() {
/// Wait until [received] satisfies [predicate]. Polls the list (it
/// gets mutated by the listener subscription) every 25 ms with a
/// generous 8 s ceiling; fails loudly on miss instead of silently
/// continuing as the old fixed-sleep tests did.
/// generous [ioTimeout] ceiling; fails loudly on miss instead of
/// silently continuing as the old fixed-sleep tests did.
Future<void> _expectReceived<T>(List<T> received, bool Function(T) predicate) async {
final deadline = DateTime.now().add(const Duration(seconds: 8));
final deadline = DateTime.now().add(ioTimeout);
while (!received.any(predicate)) {
if (DateTime.now().isAfter(deadline)) {
fail('expected event never arrived within 8s; received=${received.length} entries');
fail('expected event never arrived within ${ioTimeout.inSeconds}s; received=${received.length} entries');
}
await Future<void>.delayed(const Duration(milliseconds: 25));
}