[flutter_tools] warn when main library is relocated (#62930)
This commit is contained in:
@@ -609,6 +609,67 @@ void main() {
|
||||
Usage: () => MockUsage(),
|
||||
}));
|
||||
|
||||
testUsingContext('ResidentRunner reports error with missing entrypoint file', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
listViews,
|
||||
listViews,
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
method: 'getIsolate',
|
||||
args: <String, Object>{
|
||||
'isolateId': '1',
|
||||
},
|
||||
jsonResponse: fakeUnpausedIsolate.toJson(),
|
||||
),
|
||||
FakeVmServiceRequest(
|
||||
method: 'ext.flutter.reassemble',
|
||||
args: <String, Object>{
|
||||
'isolateId': fakeUnpausedIsolate.id,
|
||||
},
|
||||
),
|
||||
]);
|
||||
when(mockDevice.sdkNameAndVersion).thenAnswer((Invocation invocation) async {
|
||||
return 'Example';
|
||||
});
|
||||
when(mockDevice.targetPlatform).thenAnswer((Invocation invocation) async {
|
||||
return TargetPlatform.android_arm;
|
||||
});
|
||||
when(mockDevice.isLocalEmulator).thenAnswer((Invocation invocation) async {
|
||||
return false;
|
||||
});
|
||||
final Completer<DebugConnectionInfo> onConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
||||
final Completer<void> onAppStart = Completer<void>.sync();
|
||||
unawaited(residentRunner.attach(
|
||||
appStartedCompleter: onAppStart,
|
||||
connectionInfoCompleter: onConnectionInfo,
|
||||
));
|
||||
await onAppStart.future;
|
||||
when(mockFlutterDevice.updateDevFS(
|
||||
mainUri: anyNamed('mainUri'),
|
||||
target: anyNamed('target'),
|
||||
bundle: anyNamed('bundle'),
|
||||
firstBuildTime: anyNamed('firstBuildTime'),
|
||||
bundleFirstUpload: anyNamed('bundleFirstUpload'),
|
||||
bundleDirty: anyNamed('bundleDirty'),
|
||||
fullRestart: anyNamed('fullRestart'),
|
||||
projectRootPath: anyNamed('projectRootPath'),
|
||||
pathToReload: anyNamed('pathToReload'),
|
||||
invalidatedFiles: anyNamed('invalidatedFiles'),
|
||||
dillOutputPath: anyNamed('dillOutputPath'),
|
||||
packageConfig: anyNamed('packageConfig'),
|
||||
)).thenAnswer((Invocation invocation) async {
|
||||
return UpdateFSReport(success: true);
|
||||
});
|
||||
|
||||
final OperationResult result = await residentRunner.restart(fullRestart: false);
|
||||
|
||||
expect(globals.fs.file(globals.fs.path.join('lib', 'main.dart')), isNot(exists));
|
||||
expect(testLogger.errorText, contains('The entrypoint file (i.e. the file with main())'));
|
||||
expect(result.fatal, false);
|
||||
expect(result.code, 0);
|
||||
}));
|
||||
|
||||
|
||||
testUsingContext('ResidentRunner can send target platform to analytics from hot reload', () => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||
|
||||
Reference in New Issue
Block a user