parseCiTestCounts function
The counts of the last dart test / flutter test progress line among
lines, or null when there is none (the run died before testing).
Implementation
CiTestCounts? parseCiTestCounts(Iterable<String> lines) {
CiTestCounts? last;
for (final raw in lines) {
// A compact reporter rewrites one line with carriage returns; the last
// segment is the current state.
for (final segment in raw.replaceAll(_ansi, '').split('\r')) {
final m = _progress.firstMatch(segment);
if (m == null) continue;
last = CiTestCounts(
int.parse(m.group(1)!),
int.parse(m.group(2) ?? '0'),
int.parse(m.group(3) ?? '0'),
);
}
}
return last;
}