getTestsFromProvided method

List<String> getTestsFromProvided(
  1. List<String> providedTests
)

Implementation

List<String> getTestsFromProvided(List<String> providedTests) {
  final testsToRun = <String>[];
  for (final fileOrDir in providedTests) {
    if (fs.isFileSync(fileOrDir)) {
      testsToRun.add(fileOrDir);
    } else if (fs.isDirectorySync(fileOrDir)) {
      final files = fs.directory(fileOrDir).listSync(recursive: true);
      for (final file in files) {
        if (file is File) {
          testsToRun.add(file.path);
        }
      }
    } else {
      logger.err('File or directory not found: $fileOrDir');
    }
  }

  logger.detail('Running tests: \n  - ${testsToRun.join('\n  - ')}');
  return testsToRun;
}