anchor.diff:        } finally {
           tryToDelete(tempDir);
         }
  -    }, overrides: <Type, Generator>{
  -      Pub: () => const Pub(),
  -      ...noColorTerminalOverride
       });
   
       testUsingContext('returns no issues when source is error-free', () async {
  
positive.code:   final String analyzerSeparator = globals.platform.isWindows ? '-' : '•';
  
    group('analyze once', () {
      Directory tempDir;
      String projectPath;
      File libMain;
  
      setUpAll(() {
        Cache.disableLocking();
        tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_analyze_once_test_1.').absolute;
        projectPath = globals.fs.path.join(tempDir.path, 'flutter_project');
        libMain = globals.fs.file(globals.fs.path.join(projectPath, 'lib', 'main.dart'));
      });
  
      tearDownAll(() {
        tryToDelete(tempDir);
      });
  
      // Create a project to be analyzed
      testUsingContext('flutter create', () async {
        await runCommand(
          command: CreateCommand(),
          arguments: <String>['--no-wrap', 'create', projectPath],
          statusTextContains: <String>[
            'All done!',
            'Your application code is in ${globals.fs.path.normalize(globals.fs.path.join(globals.fs.path.relative(projectPath), 'lib', 'main.dart'))}',
          ],
        );
        expect(libMain.existsSync(), isTrue);
      }, overrides: <Type, Generator>{
        Pub: () => const Pub(),
      });
  
      // Analyze in the current directory - no arguments
      testUsingContext('working directory', () async {
        await runCommand(
          command: AnalyzeCommand(workingDirectory: globals.fs.directory(projectPath)),
          arguments: <String>['analyze'],
          statusTextContains: <String>['No issues found!'],
        );
      }, overrides: <Type, Generator>{
        Pub: () => const Pub(),
      });
  
      // Analyze a specific file outside the current directory
      testUsingContext('passing one file throws', () async {
        await runCommand(
          command: AnalyzeCommand(),
          arguments: <String>['analyze', libMain.path],
          toolExit: true,
          exitMessageContains: 'is not a directory',
        );
      }, overrides: <Type, Generator>{
        Pub: () => const Pub(),
      });
  
      // Analyze in the current directory - no arguments
      testUsingContext('working directory with errors', () async {
        // Break the code to produce the "The parameter 'onPressed' is required" hint
        // that is upgraded to a warning in package:flutter/analysis_options_user.yaml
        // to assert that we are using the default Flutter analysis options.
        // Also insert a statement that should not trigger a lint here
        // but will trigger a lint later on when an analysis_options.yaml is added.
        String source = await libMain.readAsString();
        source = source.replaceFirst(
          'onPressed: _incrementCounter,',
          '// onPressed: _incrementCounter,',
        );
        source = source.replaceFirst(
          '_counter++;',
          '_counter++; throw "an error message";',
        );
        await libMain.writeAsString(source);
  
        // Analyze in the current directory - no arguments
        await runCommand(
          command: AnalyzeCommand(workingDirectory: globals.fs.directory(projectPath)),
          arguments: <String>['analyze'],
          statusTextContains: <String>[
            'Analyzing',
            'warning $analyzerSeparator The parameter \'onPressed\' is required',
            'info $analyzerSeparator The declaration \'_incrementCounter\' isn\'t',
          ],
          exitMessageContains: '2 issues found.',
          toolExit: true,
        );
      }, overrides: <Type, Generator>{
        Pub: () => const Pub(),
        ...noColorTerminalOverride,
      });
  
      // Analyze in the current directory - no arguments
      testUsingContext('working directory with local options', () async {
        // Insert an analysis_options.yaml file in the project
        // which will trigger a lint for broken code that was inserted earlier
        final File optionsFile = globals.fs.file(globals.fs.path.join(projectPath, 'analysis_options.yaml'));
        await optionsFile.writeAsString('''
    include: package:flutter/analysis_options_user.yaml
    linter:
      rules:
        - only_throw_errors
    ''');
  
        // Analyze in the current directory - no arguments
        await runCommand(
          command: AnalyzeCommand(workingDirectory: globals.fs.directory(projectPath)),
          arguments: <String>['analyze'],
          statusTextContains: <String>[
            'Analyzing',
            'warning $analyzerSeparator The parameter \'onPressed\' is required',
            'info $analyzerSeparator The declaration \'_incrementCounter\' isn\'t',
            'info $analyzerSeparator Only throw instances of classes extending either Exception or Error',
          ],
          exitMessageContains: '3 issues found.',
          toolExit: true,
        );
      }, overrides: <Type, Generator>{
        Pub: () => const Pub(),
        ...noColorTerminalOverride
      });
  
      testUsingContext('no duplicate issues', () async {
        final Directory tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_analyze_once_test_2.').absolute;
  
        try {
          final File foo = globals.fs.file(globals.fs.path.join(tempDir.path, 'foo.dart'));
  
negative.code: StringBuffer bar = StringBuffer('baz');
  ''';
        final Directory tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_analyze_once_test_4.');
        _createDotPackages(tempDir.path);
  
        tempDir.childFile('main.dart').writeAsStringSync(contents);
        try {
          await runCommand(
            command: AnalyzeCommand(workingDirectory: globals.fs.directory(tempDir)),
            arguments: <String>['analyze', '--no-pub'],
            statusTextContains: <String>['No issues found!'],
          );
        } finally {
          tryToDelete(tempDir);
        }
      }, overrides: <Type, Generator>{
        ...noColorTerminalOverride
      });
    });
  