[tools] Allow skipping packages by Dart version (#6038)

This commit is contained in:
stuartmorgan
2022-06-30 19:34:08 -04:00
committed by GitHub
parent 840feda14f
commit b232558eb8
5 changed files with 86 additions and 18 deletions

View File

@ -340,7 +340,7 @@ void main() {
}
});
test('skips unsupported versions when requested', () async {
test('skips unsupported Flutter versions when requested', () async {
final RepositoryPackage excluded = createFakePlugin(
'a_plugin', packagesDir,
flutterConstraint: '>=2.10.0');
@ -370,6 +370,37 @@ void main() {
'$_startSkipColor SKIPPING: Does not support Flutter 2.5.0$_endColor',
]));
});
test('skips unsupported Dart versions when requested', () async {
final RepositoryPackage excluded = createFakePackage(
'excluded_package', packagesDir,
isFlutter: false, dartConstraint: '>=2.17.0 <3.0.0');
final RepositoryPackage included = createFakePackage(
'a_package', packagesDir,
isFlutter: false, dartConstraint: '>=2.14.0 <3.0.0');
final TestPackageLoopingCommand command = createTestCommand(
packageLoopingType: PackageLoopingType.includeAllSubpackages,
hasLongOutput: false);
final List<String> output = await runCommand(command,
arguments: <String>['--skip-if-not-supporting-dart-version=2.14.0']);
expect(
command.checkedPackages,
unorderedEquals(<String>[
included.path,
getExampleDir(included).path,
]));
expect(command.checkedPackages, isNot(contains(excluded.path)));
expect(
output,
containsAllInOrder(<String>[
'${_startHeadingColor}Running for a_package...$_endColor',
'${_startHeadingColor}Running for excluded_package...$_endColor',
'$_startSkipColor SKIPPING: Does not support Dart 2.14.0$_endColor',
]));
});
});
group('output', () {