Skip to content

[material_ui] Reduce the material_ui non-wasm web test suite - #12763

Open
elliette wants to merge 3 commits into
flutter:mainfrom
elliette:reduce-web-tests
Open

[material_ui] Reduce the material_ui non-wasm web test suite#12763
elliette wants to merge 3 commits into
flutter:mainfrom
elliette:reduce-web-tests

Conversation

@elliette

@elliette elliette commented Sep 4, 2026

Copy link
Copy Markdown
Member

Work towards flutter/flutter#192308

Introduce new --package-tags flag that can be used to specify which flags to filter a package's tests with. In the case of the web_dart_unit_tests, we specify that material_ui should filter on the new reduced_web_test_set tag.

Pre-Review Checklist

changelog exemption: only test/CI changes

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@elliette elliette added the CICD Run CI/CD label Sep 4, 2026
@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Sep 4, 2026
@elliette elliette changed the title [DRAFT] Reduce the material_ui web test suite [material_ui] Reduce the material_ui web test suite Sep 4, 2026
@elliette elliette changed the title [material_ui] Reduce the material_ui web test suite [material_ui] Reduce the material_ui non-wasm web test suite Sep 4, 2026
@elliette
elliette marked this pull request as ready for review September 4, 2026 23:11

@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 a --package-tags option to the dart-test command in the repository tooling, enabling packages to run only tests matching a specified tag. The material_ui package is configured to run a reduced set of web tests using the reduced-web-test-set tag, and CI configurations are updated to utilize this new option. Feedback on the changes suggests handling cases where the package tags YAML file is empty or contains only comments to prevent a misleading error message when loadYaml returns null.

Comment on lines +206 to +218
final Object? yaml = loadYaml(file.readAsStringSync());
if (yaml is YamlMap) {
for (final MapEntry<dynamic, dynamic> entry in yaml.entries) {
final pkg = entry.key.toString();
final dynamic val = entry.value;
if (val != null) {
packageTags[pkg] = val.toString();
}
}
} else {
printError('The package tags file "$arg" is not a valid YAML map.');
throw ToolExit(exitInvalidArguments);
}

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

If the YAML file is empty or contains only comments, loadYaml will return null. Currently, this will fall through to the else block and throw a ToolExit with a confusing error message ('is not a valid YAML map'). It would be more robust to handle null gracefully by returning an empty map.

    final Object? yaml = loadYaml(file.readAsStringSync());
    if (yaml == null) {
      _packageTags = packageTags;
      return packageTags;
    }
    if (yaml is YamlMap) {
      for (final MapEntry<dynamic, dynamic> entry in yaml.entries) {
        final pkg = entry.key.toString();
        final dynamic val = entry.value;
        if (val != null) {
          packageTags[pkg] = val.toString();
        }
      }
    } else {
      printError('The package tags file "$arg" is not a valid YAML map.');
      throw ToolExit(exitInvalidArguments);
    }

/// Returns the tag to apply for [package] based on `--package-tags`, or null
/// if none.
String? _getTagForPackage(RepositoryPackage package) {
final Map<String, String> packageTags = _getPackageTags();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can do a full review on Tuesday, but as a quick note generally global state initialization goes in an @override Future<void> initializeRun() async, which is called once per run rather than once per package. (Obviously the cost is pretty low here, but there's no need to read and parse a repo-level file N times.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: material_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants