Unverified Commit 50eeda24 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] fix frontend server generated entrypoint (#50036)

parent 5039e259
......@@ -515,7 +515,7 @@ class _ExperimentalResidentWebRunner extends ResidentWebRunner {
'import "$generatedImport";',
'Future<void> main() async {',
if (hasWebPlugins)
' registerPlugins(webPluginRegistry);'
' registerPlugins(webPluginRegistry);',
' await ui.webOnlyInitializePlatform();',
' entrypoint.main();',
'}',
......
......@@ -414,6 +414,7 @@ void main() {
test('Can hot restart after attaching - experimental', () => testbed.run(() async {
_setupMocks();
launchChromeInstance(mockChrome);
String entrypointFileName;
when(mockWebDevFS.update(
mainPath: anyNamed('mainPath'),
target: anyNamed('target'),
......@@ -428,6 +429,7 @@ void main() {
pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'),
)).thenAnswer((Invocation invocation) async {
entrypointFileName = invocation.namedArguments[#mainPath] as String;
return UpdateFSReport(success: true)
..invalidatedModules = <String>['example'];
});
......@@ -438,6 +440,12 @@ void main() {
await connectionInfoCompleter.future;
final OperationResult result = await residentWebRunner.restart(fullRestart: true);
// Ensure that generated entrypoint is generated correctly.
expect(entrypointFileName, isNotNull);
expect(globals.fs.file(entrypointFileName).readAsStringSync(), contains(
'await ui.webOnlyInitializePlatform();'
));
expect(testLogger.statusText, contains('Restarted application in'));
expect(result.code, 0);
verify(mockResidentCompiler.accept()).called(2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment