diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart index 34b8f7e53..3f5842f6b 100644 --- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart +++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart @@ -423,13 +423,14 @@ class GithubWebhookSubscription extends SubscriptionHandler { // for the purposes of testing a change that otherwise needs tests, // but since they are the driver for tests they don't need test // coverage. - !filename.endsWith('tool/run_tests.dart') && !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/')) || // Native iOS/macOS tests. filename.contains('RunnerTests/') || filename.contains('RunnerUITests/') || diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart index 0b4ef1bd3..f04d9f8e2 100644 --- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart +++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart @@ -1692,6 +1692,7 @@ void foo() { ), ); }); + test('Packages does not comment if Pigeon native tests', () async { const int issueNumber = 123; @@ -1699,6 +1700,7 @@ void foo() { action: 'opened', number: issueNumber, slug: Config.packagesSlug, + baseRef: Config.defaultBranch(Config.packagesSlug), ); when(pullRequestsService.listFiles(Config.packagesSlug, issueNumber)).thenAnswer( (_) => Stream.fromIterable([ @@ -1719,6 +1721,37 @@ void foo() { ); }); + test('Packages does not comment if editing test files in tool/', () async { + const int issueNumber = 123; + + tester.message = generateGithubWebhookMessage( + action: 'opened', + number: issueNumber, + slug: Config.packagesSlug, + baseRef: Config.defaultBranch(Config.packagesSlug), + ); + when(pullRequestsService.listFiles(Config.packagesSlug, issueNumber)).thenAnswer( + (_) => Stream.fromIterable([ + PullRequestFile() + ..filename = 'packages/packages/go_router/tool/test_fixes/go_router.dart' + ..additionsCount = 10, + PullRequestFile() + ..filename = 'packages/packages/go_router/lib/fix_data.yaml' + ..additionsCount = 10, + ]), + ); + + await tester.post(webhook); + + verifyNever( + issuesService.createComment( + Config.packagesSlug, + issueNumber, + argThat(contains(config.missingTestsPullRequestMessageValue)), + ), + ); + }); + test('Packages comments and labels if no tests', () async { const int issueNumber = 123;