-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
There is a check in flavors_test.dart that can never fail, even when it should. There are also similar checks in flavors_test_ios.dart and flavors_test_macos, but the rest of this text will focus on flavors_test.dart for the sake of brevity.
See
| await inDirectory('${flutterDirectory.path}/dev/integration_tests/flavors', () async { |
This block effectively contains captures two checks:
- That
flutter installandflutter install --uninstall-onlyworks when--flavoris used (code), and - That
flutter installfails when given an invalid--flavor(code) (and that the error message is useful).
In the second test, we return TaskResult.failure('Should not succeed with bogus flavor'); if the check fails. However, this result isn't used. To demonstrate, you can move this can invert the condition of the if statement containing the return TaskResult.failure statement, and the test will still pass.
You can run the test locally from the dev/devicelab directory using this command:
../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t flavors_test
You may need to set ANDROID_SDK_ROOT before this. See dev/devicelab/README.md for more details.
Ideally, the fix would be to capture the return value of the inDirectory call and return that.
Other issues:
flavors_test(meant for Android devices) doesn't test for the correct error string when trying to build with an invalid flavor (--flavor bogus). It tests for Xcode output, which will never be found because the test isn't building for iOS or MacOSflavors_test_iostests for Xcode output, but it tests for an outdated string