Skip to content

[flutter_tools] Add --preset option to flutter test - #190878

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-189191
Aug 11, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
bkonyi:issue-189191

Conversation

@bkonyi

@bkonyi bkonyi commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Adds support for `--preset` (and `-P`) to `flutter test`, allowing test presets defined in `dart_test.yaml` to be passed through to `package:test`.

Fixes #189191

Pre-launch Checklist

flutter test now supports --preset (or -P) option and forwards it to package:test. This allows users to use presets defined in dart_test.yaml.

Fixes flutter#189191
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 10, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 10, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the --preset (or -P) option to the flutter test command, allowing developers to specify configuration presets when running tests. The option is propagated through the test runner to package:test, and corresponding unit tests have been added to verify this behavior. Feedback suggests updating the help message for the --preset option to explicitly mention that presets are defined in dart_test.yaml to improve clarity.

..addMultiOption(
'preset',
abbr: 'P',
help: 'The configuration preset(s) to use.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the help message more informative for developers who might not be familiar with where presets are defined, consider explicitly mentioning that they are defined in dart_test.yaml.

Suggested change
help: 'The configuration preset(s) to use.',
help: 'The configuration preset(s) to use. Presets are defined in "dart_test.yaml".',
References
  1. Documentation and help messages should be useful and introduce terms, assuming the reader does not know everything. (link)

@bkonyi
bkonyi requested a review from chingjun August 11, 2026 15:56
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit

auto-submit Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/190878, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 11, 2026
Merged via the queue into flutter:master with commit db3ac02 Aug 11, 2026
27 of 28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 11, 2026
Boulea7 added a commit to Boulea7/flutter that referenced this pull request Aug 12, 2026
Exercise short and long preset flags through the real flutter test command, including undefined presets and combination with name filters. This extends the unit coverage added in flutter#190878.
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 13, 2026
…#12453)

Manual roll Flutter from 27b098811f3b to c2437523d308 (179 revisions)

Manual roll requested by [email protected]

flutter/flutter@27b0988...c243752

2026-08-12 [email protected] Enable Gradle CI cache on all test targets that require android_sdk (flutter/flutter#190723)
2026-08-12 [email protected] [analysis] Reland "Added initial implementation of the flutter_analyzer_plugin (#175679)" (flutter/flutter#191022)
2026-08-12 [email protected] Switch testing to gradle bin distribution type instead of all (flutter/flutter#190738)
2026-08-12 [email protected] Convert Mockito instances in Kotlin to Mockk (flutter/flutter#189884)
2026-08-12 [email protected] Report individual test results to LUCI ResultDB (flutter/flutter#190254)
2026-08-12 [email protected] Toggleable reaction duration respects overrides (flutter/flutter#190857)
2026-08-12 [email protected] Roll Skia from e00dbd7448c4 to fee7272f5bc2 (1 revision) (flutter/flutter#191007)
2026-08-12 [email protected] Started caching text shadows by content. (flutter/flutter#190681)
2026-08-12 [email protected] Adds agent skill for spawning led tasks. (flutter/flutter#190937)
2026-08-12 [email protected] Roll Packages from aaaf246 to 94485f1 (8 revisions) (flutter/flutter#191008)
2026-08-12 [email protected] flutter_tools: validate plugin identifiers before generating registrant code (flutter/flutter#190462)
2026-08-12 [email protected] Roll Skia from 112f36148949 to e00dbd7448c4 (3 revisions) (flutter/flutter#190993)
2026-08-12 [email protected] Roll Skia from 7d366c802307 to 112f36148949 (3 revisions) (flutter/flutter#190983)
2026-08-12 [email protected] remove bringup for flavors test (flutter/flutter#190940)
2026-08-12 [email protected] Roll Skia from 1f10a20bdd61 to 7d366c802307 (2 revisions) (flutter/flutter#190980)
2026-08-12 [email protected] Remove `--no-sim-use-hardfp` flag (flutter/flutter#190790)
2026-08-12 [email protected] Roll pub packages (flutter/flutter#190977)
2026-08-12 [email protected] Roll Skia from 339bedab6766 to 1f10a20bdd61 (1 revision) (flutter/flutter#190975)
2026-08-12 [email protected] RawTooltip respects AnimationStyle updates and reverseCurve (flutter/flutter#190889)
2026-08-12 [email protected] ci: Support --target_arch option in prepare_package.dart (flutter/flutter#190960)
2026-08-12 [email protected] Roll Fuchsia Linux SDK from SFq4FVodIOQAS26Lr... to -uHuSGv3wt7QAlDwa... (flutter/flutter#190973)
2026-08-12 [email protected] Removes building of ci/android_debug_x86 as nobody should be consuming it. (flutter/flutter#190951)
2026-08-12 [email protected] Adds error about wimp_heavy not being implemented. (flutter/flutter#189945)
2026-08-11 [email protected] Add clang, cmake, and ninja deps to Linux windowing_test (flutter/flutter#190119)
2026-08-11 [email protected] [AGP 9.1.0 Migration #1] Add Android Gradle Plugin Public API migration documentation (flutter/flutter#190842)
2026-08-11 [email protected] [flutter_tools] Fix deadlock in debug adapters when process exits early (flutter/flutter#190931)
2026-08-11 [email protected] [tool] Define modular dependency injection containers and bootstrapper (flutter/flutter#190724)
2026-08-11 [email protected] [web] Unify MaskFilter and ColorFilter primitives across CanvasKit and Skwasm (flutter/flutter#190314)
2026-08-11 [email protected] Roll pub packages (flutter/flutter#190958)
2026-08-11 [email protected] [Impeller] Move image upload scheduling waits to GPU disable (flutter/flutter#190445)
2026-08-11 [email protected] Started generating the windows platform for macrobenchmarks (flutter/flutter#190932)
2026-08-11 [email protected] [web] Unify ui.Vertices (flutter/flutter#190563)
2026-08-11 [email protected] Fix accessibility_inspector service extensions map mutability (flutter/flutter#190888)
2026-08-11 [email protected] Add batch3 a11y_assessment for vpat (flutter/flutter#189042)
2026-08-11 [email protected] Remove Xcode environment when building swift tools in Xcode pre-action (flutter/flutter#190848)
2026-08-11 [email protected] [tool] Add missing play element in web test index.html to fix warning (flutter/flutter#190675)
2026-08-11 [email protected] Offload blocking work in ProcessTextPlugin to the background (flutter/flutter#189823)
2026-08-11 [email protected] [flutter_tools] Replace usages of package:dds/dap.dart with package:dap_adapters/dap_adapters.dart (flutter/flutter#190667)
2026-08-11 [email protected] Always update swift package dependencies (flutter/flutter#190886)
2026-08-11 [email protected] [flutter_tools] Add --preset option to flutter test (flutter/flutter#190878)
2026-08-11 [email protected] Include the examples cross imports checker in the analzyer. (flutter/flutter#190674)
2026-08-11 [email protected] [devicelab] Remove orphaned screenshot test files (flutter/flutter#190879)
2026-08-11 [email protected] Remove the bringup flag from the linux_arm_host_desktop_engine builder (flutter/flutter#190935)
2026-08-11 [email protected] Reduce web_skwasm_tests subshards from 8 to 2 (flutter/flutter#190728)
...
chingjun pushed a commit to Boulea7/flutter that referenced this pull request Aug 18, 2026
Exercise short and long preset flags through the real flutter test command, including undefined presets and combination with name filters. This extends the unit coverage added in flutter#190878.
pull Bot pushed a commit to AmirulAndalib/flutter that referenced this pull request Aug 18, 2026
…0858)

flutter#190878 added `--preset` / `-P` support to `flutter test`. This PR adds
real-command integration coverage for that behavior in both the standard
and experimental faster test runners.

The tests exercise the short and long flag forms, an undefined preset,
composition with `--plain-name`, and a two-file
`--experimental-faster-testing` invocation.

Related to flutter#189191.

## Tests

- `../../bin/flutter test --no-pub
test/commands.shard/hermetic/test_test.dart` (56 tests)
- `../../bin/flutter test --no-pub test/integration.shard/test_test.dart
--concurrency=1` (39 tests)
- `../../bin/flutter test --no-pub --experimental-faster-testing -P
passing flutter_test/preset_test.dart flutter_test/trivial_test.dart`
- `./bin/dart analyze --fatal-infos
packages/flutter_tools/lib/src/commands/test.dart
packages/flutter_tools/lib/src/test/runner.dart
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
packages/flutter_tools/test/integration.shard/test_test.dart
dev/automated_tests/flutter_test/preset_test.dart`
- `./bin/dart format --output=none --set-exit-if-changed
packages/flutter_tools/lib/src/commands/test.dart
packages/flutter_tools/lib/src/test/runner.dart
packages/flutter_tools/test/commands.shard/hermetic/test_test.dart
packages/flutter_tools/test/integration.shard/test_test.dart
dev/automated_tests/flutter_test/preset_test.dart`
- `./bin/flutter analyze --flutter-repo`
- `git diff --check`

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement]. The change is limited to
flutter_tools tests and does not add widgets.
- [x] I signed the [CLA]. This must be confirmed by the account holder.
- [x] I listed at least one issue that this PR relates to in the
description above.
- [x] I updated/added relevant documentation (doc comments with `///`).
No public API is added by this test-only change.
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported. This is a test-only change and does not alter an
API.
- [x] All existing and new tests are passing in the affected suites
listed above.

[Contributor Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[breaking change policy]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Data-driven-Fixes.md#deprecations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter test does not support --preset flag

2 participants