notRecordedFailure function

  1. @visibleForTesting
String? notRecordedFailure(
  1. String scenario,
  2. List<String> missed,
  3. String store
)

Why a scenario fails when replay refused requests the recording does not hold, or null when it refused none.

Failed once its body is over rather than on the first miss, so one run lists the whole gap instead of one url per attempt. off refuses without failing, because there a request is incidental — a decorative avatar is no reason to throw away a flow's other assertions. replay is a scenario asking for the network, and every picture after a refusal shows the recording's gap instead of the app: a green run over an empty store is the one outcome nobody can catch by reading the result.

A recorded error is not a miss. A 404 the server said is a recording of a 404, and a scenario about a missing page is entitled to it.

Implementation

@visibleForTesting
String? notRecordedFailure(String scenario, List<String> missed, String store) {
  if (missed.isEmpty) return null;
  var listed = missed.take(10);
  return '"$scenario" replays the network, and the recording at `$store` '
      'holds nothing for ${missed.length == 1 ? 'one request' : '${missed.length} requests'} it made:\n'
      '${listed.map((key) => '  $key\n').join()}'
      '${missed.length > listed.length ? '  … and ${missed.length - listed.length} more\n' : ''}'
      '\n'
      'Record them and commit what comes back:\n'
      '  fw run scenarios run --network=record';
}