recordOverriddenMessage function

  1. @visibleForTesting
String? recordOverriddenMessage(
  1. String scenario,
  2. ScenarioNetwork? own,
  3. ScenarioNetwork? run
)

The sentence a record run owes scenario, or null when nothing is wrong.

The one losing combination in the ladder worth interrupting for, because it is the only one where nothing on the screen and nothing in the output says what happened: the suite passes, every picture is the one replay already had, and the store the run was for stays exactly as it was. Every other pairing shows itself — a scenario keeping off against a live run draws the blank image and reports the refusal on the step.

A message rather than a rule. Letting record reach past own would put a special case inside a precedence ladder, and a ladder with an exception in it is what was misread here to begin with — it would also start recording for a scenario that deliberately said live.

Implementation

@visibleForTesting
String? recordOverriddenMessage(
  String scenario,
  ScenarioNetwork? own,
  ScenarioNetwork? run,
) {
  if (run != ScenarioNetwork.record) return null;
  if (own == null || own == ScenarioNetwork.record) return null;
  return '"$scenario" sets `network: ${own.name}`, so this `record` run '
      'skipped it and recorded nothing for it. The nearest setting wins: a '
      '`scenario(network: ...)` overrides the run, and a run only overrides '
      'the folder and the project. To record it, move the setting to the '
      'folder with `runScenarios(network: ...)` in `flutter_test_config.dart`, '
      'where `--network=` can override it.';
}