Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix release-info for test-only changes
  • Loading branch information
stuartmorgan-g committed Nov 21, 2022
commit bb3dd093d3cdc5a90b05fd1a22429b04b63abbf4
3 changes: 3 additions & 0 deletions script/tool/lib/src/update_release_info_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ class UpdateReleaseInfoCommand extends PackageLoopingCommand {
if (!state.hasChanges) {
return PackageResult.skip('No changes to package');
}
if (!state.needsVersionChange && !state.needsChangelogChange) {
return PackageResult.skip('No non-exempt changes to package');
}
if (state.needsVersionChange) {
versionChange = _VersionIncrementType.bugfix;
}
Expand Down
30 changes: 29 additions & 1 deletion script/tool/test/update_release_info_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ $originalChangelog''';
createFakePackage('a_package', packagesDir, version: '1.0.1');
processRunner.mockProcessesForExecutable['git-diff'] = <io.Process>[
MockProcess(stdout: '''
packages/different_package/test/plugin_test.dart
packages/different_package/lib/foo.dart
'''),
];
final String originalChangelog = package.changelogFile.readAsStringSync();
Expand All @@ -411,6 +411,34 @@ packages/different_package/test/plugin_test.dart
]));
});

test('skips for "minimal" when there are only test changes', () async {
final RepositoryPackage package =
createFakePackage('a_package', packagesDir, version: '1.0.1');
processRunner.mockProcessesForExecutable['git-diff'] = <io.Process>[
MockProcess(stdout: '''
packages/a_package/test/plugin_test.dart
'''),
];
final String originalChangelog = package.changelogFile.readAsStringSync();

final List<String> output = await runCapturingPrint(runner, <String>[
'update-release-info',
'--version=minimal',
'--changelog',
'A change.',
]);

final String version = package.parsePubspec().version?.toString() ?? '';
expect(version, '1.0.1');
expect(package.changelogFile.readAsStringSync(), originalChangelog);
expect(
output,
containsAllInOrder(<Matcher>[
contains('No non-exempt changes to package'),
contains('Skipped 1 package')
]));
});

test('fails if CHANGELOG.md is missing', () async {
createFakePackage('a_package', packagesDir, includeCommonFiles: false);

Expand Down