mirror of
https://github.com/flutter/packages.git
synced 2025-06-29 14:18:54 +08:00
[ci] version_check_command now checks markdown of first CHANGELOG line. (#7266)
This PR: * Modifies the `version_check_command` test so it checks the leading markdown of the first line of a CHANGELOG file, to ensure it's `'##'`. * Fixes the CHANGELOG in two packages that were allowed by the tool before this fix: * google_maps_flutter_web * interactive_media_ads ## Issues Fixes https://github.com/flutter/flutter/issues/152638
This commit is contained in:
@ -641,6 +641,41 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('fails gracefully if the first entry uses the wrong style', () async {
|
||||
final RepositoryPackage plugin =
|
||||
createFakePlugin('plugin', packagesDir, version: '1.0.0');
|
||||
|
||||
const String changelog = '''
|
||||
# 1.0.0
|
||||
* Some changes for a later release.
|
||||
## 0.9.0
|
||||
* Some earlier changes.
|
||||
''';
|
||||
plugin.changelogFile.writeAsStringSync(changelog);
|
||||
processRunner.mockProcessesForExecutable['git-show'] = <FakeProcessInfo>[
|
||||
FakeProcessInfo(MockProcess(stdout: 'version: 1.0.0')),
|
||||
];
|
||||
|
||||
Error? commandError;
|
||||
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||
'version-check',
|
||||
'--base-sha=main',
|
||||
], errorHandler: (Error e) {
|
||||
commandError = e;
|
||||
});
|
||||
|
||||
expect(commandError, isA<ToolExit>());
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Unable to find a version in CHANGELOG.md'),
|
||||
contains('The current version should be on a line starting with '
|
||||
'"## ", either on the first non-empty line or after a "## NEXT" '
|
||||
'section.'),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'fails gracefully if the version headers are not found due to using the wrong style',
|
||||
() async {
|
||||
|
Reference in New Issue
Block a user