flushResults function
Drains attachment uploads and uploads the buffered results without closing the run.
Runners whose peer processes have no end-of-suite hook call it after each test; it must not overlap a running test.
Implementation
Future<void> flushResults(ReporterState state) async {
final session = state.session;
final buffer = state.buffer;
if (state.softDisabled || session == null || buffer == null) return;
await state.uploadPool?.drain();
await buffer.flush();
}