[flutter_plugin_tools] Check for missing version and CHANGELOG updates (#4530)

The currently documented repository policy is to:
- require version updates for packages changes that don't meet specific exemptions, and
- require CHANGELOG changes for essentially all changes.

This adds tooling that enforces that policy, with a mechanism for overriding it via PR descriptions, to avoid cases where they are accidentally omitted without reviewers catching it.

In order to facilitate testing (which require mocking another `git` command), this also updates the existing `version-check` tests:
- Replaces the custom git result injection/validating with the newer bind-to-process-mocks approach that is now used in the rest of the tool tests.
- Fixes some tests that were only checking for `ToolExit` to also check the error output, in order to ensure that failure tests are not accidentally passing for the wrong reason (as is being done in general as tests in the tooling are updated).

Fixes https://github.com/flutter/flutter/issues/93790
This commit is contained in:
stuartmorgan
2021-11-23 11:34:18 -05:00
committed by GitHub
parent f4546c0791
commit 7b6ac13139
5 changed files with 678 additions and 161 deletions

View File

@ -14,7 +14,7 @@ void main() {
late List<List<String>?> gitDirCommands;
late String gitDiffResponse;
late MockGitDir gitDir;
String? mergeBaseResponse;
String mergeBaseResponse = '';
setUp(() {
gitDirCommands = <List<String>?>[];
@ -74,7 +74,7 @@ file2/file2.cc
final GitVersionFinder finder = GitVersionFinder(gitDir, null);
await finder.getChangedFiles();
verify(gitDir.runCommand(
<String>['diff', '--name-only', mergeBaseResponse!, 'HEAD']));
<String>['diff', '--name-only', mergeBaseResponse, 'HEAD']));
});
test('use correct base sha if specified', () async {