anchor.diff:    });
   
     testWithoutContext('Logger does not throw when stdio write throws synchronously', () async {
  -    final MockStdout stdout = MockStdout();
  -    final MockStdout stderr = MockStdout();
  +    final FakeStdout stdout = FakeStdout(syncError: true);
  +    final FakeStdout stderr = FakeStdout(syncError: true);
       final Stdio stdio = Stdio.test(stdout: stdout, stderr: stderr);
  -    bool stdoutThrew = false;
  -    bool stderrThrew = false;
  -    final Completer<void> stdoutError = Completer<void>();
  -    final Completer<void> stderrError = Completer<void>();
  -    when(stdout.write(any)).thenAnswer((_) {
  -      stdoutThrew = true;
  -      throw 'Error';
  -    });
  -    when(stderr.write(any)).thenAnswer((_) {
  -      stderrThrew = true;
  -      throw 'Error';
  -    });
  -    when(stdout.done).thenAnswer((_) => stdoutError.future);
  -    when(stderr.done).thenAnswer((_) => stderrError.future);
       final Logger logger = StdoutLogger(
         terminal: AnsiTerminal(
           stdio: stdio,
  
positive.code: /// to [FakeLogger].
  Matcher _throwsInvocationFor(dynamic Function() fakeCall) =>
    throwsA(_matchesInvocation(_invocationFor(fakeCall)));
  
negative.code:       stdio: stdio,
        outputPreferences: OutputPreferences.test(),
      );
  
      logger.printStatus('message');
      logger.printError('error message');
    });
  
    testWithoutContext('Logger does not throw when stdio write throws asynchronously', () async {
      final FakeStdout stdout = FakeStdout(syncError: false);
      final FakeStdout stderr = FakeStdout(syncError: false);
      final Stdio stdio = Stdio.test(stdout: stdout, stderr: stderr);
      final Logger logger = StdoutLogger(
        terminal: AnsiTerminal(
          stdio: stdio,
  