flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.35k stars 27.54k forks source link

[integration_test] Throw a graceful error when attempting to run `flutter drive --web-renderer skwasm` #151559

Open Rexios80 opened 4 months ago

Rexios80 commented 4 months ago

Use case

This command pretends to work, but the launched web build is broken: flutter drive --web-renderer skwasm

The proper command is as follows: flutter drive --wasm

This has caused me confusion in the past due to the command structure of running dart tests compiled to wasm: dart run -p chrome -c dart2wasm

See https://github.com/flutter/flutter/issues/150947

Proposal

Throw a graceful error like flutter run --web-renderer skwasm instead of launching a broken web build

Rexios80 commented 4 months ago

I found where this error is supposed to be thrown: https://github.com/flutter/flutter/blob/b9b0784ea4089ee394c0ba92658bd4d25e466b9d/packages/flutter_tools/lib/src/commands/run.dart#L671

But it appears validateCommand isn't getting called for flutter drive somehow

huycozy commented 4 months ago

Thanks for the proposal. For context, when running the test with flutter drive --web-renderer skwasm, there is an error on browser's console that makes the Flutter program hang (the detail use case is on https://github.com/flutter/flutter/issues/150947):

Uncaught (in promise) FlutterLoader could not find a build compatible with configuration and environment.
andrewkolos commented 4 months ago

I found where this error is supposed to be thrown:

https://github.com/flutter/flutter/blob/b9b0784ea4089ee394c0ba92658bd4d25e466b9d/packages/flutter_tools/lib/src/commands/run.dart#L671

But it appears validateCommand isn't getting called for flutter drive somehow

The code pointed out here is for the run command. Perhaps it should be moved from RunCommand to the parent RunCommandBase, which DriveCommand also extends.

Rexios80 commented 4 months ago

You are totally right! For some reason I thought that code was in the base class.