[flutter_tools] support run -d chrome test scripts (#51658)

This commit is contained in:
Jonah Williams
2020-02-28 14:21:02 -08:00
committed by GitHub
parent 266742e12d
commit 9b4159c5ee
8 changed files with 49 additions and 6 deletions

View File

@@ -573,7 +573,13 @@ class _ResidentWebRunner extends ResidentWebRunner {
.childFile('generated_plugin_registrant.dart')
.absolute.path;
final Uri generatedImport = packageUriMapper.map(generatedPath);
final String importedEntrypoint = packageUriMapper.map(main).toString() ?? 'file://$main';
String importedEntrypoint = packageUriMapper.map(main)?.toString();
// Special handling for entrypoints that are not under lib, such as test scripts.
if (importedEntrypoint == null) {
final String parent = globals.fs.file(main).parent.path;
flutterDevices.first.generator.addFileSystemRoot(parent);
importedEntrypoint = 'org-dartlang-app:///${globals.fs.path.basename(main)}';
}
final String entrypoint = <String>[
'import "$importedEntrypoint" as entrypoint;',