forked from firka/flutter
Add a better error message when flutter drive --target is used incorrectly. (#162023)
Closes https://github.com/flutter/flutter/issues/62626.
This commit is contained in:
@@ -284,6 +284,15 @@ class DriveCommand extends RunCommandBase {
|
||||
throwToolExit(null);
|
||||
}
|
||||
if (await _fileSystem.type(testFile) != FileSystemEntityType.file) {
|
||||
// A very common source of error is holding "flutter drive" wrong,
|
||||
// and providing the "test_driver/foo_test.dart" as the target, when
|
||||
// the intention was to provide "lib/foo.dart".
|
||||
if (_fileSystem.path.isWithin('test_driver', targetFile)) {
|
||||
_logger.printError(
|
||||
'The file path passed to --target should be an app entrypoint that '
|
||||
'contains a "main()". Did you mean "flutter drive --driver $targetFile"?',
|
||||
);
|
||||
}
|
||||
throwToolExit('Test file not found: $testFile');
|
||||
}
|
||||
final Device? device = await targetedDevice;
|
||||
|
||||
Reference in New Issue
Block a user