Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counts go_router and go_router_builder custom test folders as tests #2973

Merged
merged 4 commits into from
Aug 3, 2023

Conversation

chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Aug 2, 2023

related flutter/packages#4627

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

!filename.endsWith('run_tests.sh')) {
needsTests = !_allChangesAreCodeComments(file);
}
// See https://github.com/flutter/flutter/wiki/Plugin-Tests for discussion
// of various plugin test types and locations.
if (filename.endsWith('_test.dart') ||
// Test files in custom package-specific test folders.
filename.contains(RegExp('packages/packages/[^/]+/tool/')) ||
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not the case that everything in the tool directory is a test, so this is too broad. tool is just the convention for non-public scripts: https://dart.dev/tools/pub/package-layout#public-tools

E.g., a code generation script might live in tool, but not be a test.

Copy link
Contributor Author

@chunhtai chunhtai Aug 2, 2023

Choose a reason for hiding this comment

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

What about we match any file that has word test anywhere in this folder? something like this
'packages/packages/[^/]+/tool/.+test.+'

Or do you prefer more package specific exception here? like
packages/packages/go_router/tool/test_fixes

Copy link
Contributor

Choose a reason for hiding this comment

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

What about we match any file that has word test anywhere in this folder? something like this
'packages/packages/[^/]+/tool/.+test.+'

There are currently only three examples of that pattern, at at least one is a false positive (pigeon/tool/test.dart, which is just a script for running manual tests locally, so provides no automated test coverage).

The missing-test bot should err on the side of false positives rather than false negatives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good I will make this more specific to package instead. If we have more and more use cases, we can come up with a more systematic solution later.

@chunhtai chunhtai changed the title Counts custom package specific test runners folder as tests Counts go_router and go_router_builder custom test folder as tests Aug 2, 2023
@chunhtai chunhtai changed the title Counts go_router and go_router_builder custom test folder as tests Counts go_router and go_router_builder custom test folders as tests Aug 2, 2023
@@ -430,6 +430,9 @@ class GithubWebhookSubscription extends SubscriptionHandler {
// See https://github.com/flutter/flutter/wiki/Plugin-Tests for discussion
// of various plugin test types and locations.
if (filename.endsWith('_test.dart') ||
// Test files in package-specific test folders.
filename.contains('packages/packages/go_router/test_fixes/') ||
filename.contains('packages/packages/go_router_builder/test_inputs/') ||
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Could you put these at the end, so the generic rules continue to be first?

@@ -430,6 +430,9 @@ class GithubWebhookSubscription extends SubscriptionHandler {
// See https://github.com/flutter/flutter/wiki/Plugin-Tests for discussion
// of various plugin test types and locations.
if (filename.endsWith('_test.dart') ||
// Test files in package-specific test folders.
filename.contains('packages/packages/go_router/test_fixes/') ||
Copy link
Contributor

Choose a reason for hiding this comment

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

The packages/packages/ part of these parts unnecessarily ties these patterns to the specific repo structure; we should just start with the package name.

Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

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

LGTM

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App. label Aug 3, 2023
@auto-submit auto-submit bot merged commit 303b86f into flutter:main Aug 3, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants