diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index 14e5d3fd1cd..fd54c104c60 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -95,10 +95,13 @@ class AnalyzeCommand extends FlutterCommand { // .../packages/*/bin/*.dart // .../packages/*/lib/main.dart + // .../packages/*/test/*_test.dart + // .../packages/*/test/*/*_test.dart Directory packages = new Directory(path.join(ArtifactStore.flutterRoot, 'packages')); for (FileSystemEntity entry in packages.listSync()) { if (entry is Directory) { bool foundOne = false; + Directory binDirectory = new Directory(path.join(entry.path, 'bin')); if (binDirectory.existsSync()) { for (FileSystemEntity subentry in binDirectory.listSync()) { @@ -108,11 +111,30 @@ class AnalyzeCommand extends FlutterCommand { } } } + String mainPath = path.join(entry.path, 'lib', 'main.dart'); if (FileSystemEntity.isFileSync(mainPath)) { dartFiles.add(mainPath); foundOne = true; } + + Directory testDirectory = new Directory(path.join(entry.path, 'test')); + if (testDirectory.existsSync()) { + for (FileSystemEntity entry in testDirectory.listSync()) { + if (entry is Directory) { + for (FileSystemEntity subentry in entry.listSync()) { + if (subentry is File && subentry.path.endsWith('_test.dart')) { + dartFiles.add(subentry.path); + foundTest = true; + } + } + } else if (entry is File && entry.path.endsWith('_test.dart')) { + dartFiles.add(entry.path); + foundTest = true; + } + } + } + if (foundOne) pubSpecDirectories.add(entry.path); }