getTestDirs method
This method is used to get the test directories and the tools to run the tests
It returns a map of test directories and the tools to run the tests
Implementation
(
  (
    List<String> testDirs,
    Map<String, DetermineFlutterOrDart> dirTools,
  )?,
  ExitCode? exitCode,
) getTestDirs(
  Iterable<String> pubspecs, {
  required bool isFlutterOnly,
  required bool isDartOnly,
}) {
  final testDirs = <String>[];
  final dirTools = <String, DetermineFlutterOrDart>{};
  logger.detail(
    'Found ${pubspecs.length} pubspecs, checking for test directories',
  );
  for (final pubspec in pubspecs) {
    final projectRoot = path.dirname(pubspec);
    final testDirectory = path.join(path.dirname(pubspec), 'test');
    if (!fs.directory(testDirectory).existsSync()) {
      logger
          .detail('No test directory found in ${path.relative(projectRoot)}');
      continue;
    }
    final tool = DetermineFlutterOrDart(
      pubspecYaml: path.join(projectRoot, 'pubspec.yaml'),
      findFile: findFile,
      pubspecLock: pubspecLock,
      scriptsYaml: scriptsYaml,
    );
    // we only care checking for flutter or
    // dart tests if we are not running both
    if (isFlutterOnly ^ isDartOnly) {
      if (tool.isFlutter && isDartOnly) {
        continue;
      }
      if (tool.isDart && isFlutterOnly) {
        continue;
      }
    }
    testDirs.add(testDirectory);
    dirTools[testDirectory] = tool;
  }
  if (testDirs.isEmpty) {
    var forTool = '';
    if (isFlutterOnly ^ isDartOnly) {
      forTool = ' ';
      forTool += isDartOnly ? 'dart' : 'flutter';
    }
    logger.err('No$forTool tests found');
    return (null, ExitCode.success);
  }
  return ((testDirs, dirTools), null);
}