Skip to content

Commit e98839a

Browse files
authored
[tool] Check for test and flutter_test in non-dev dependencies (flutter#6472)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.* Additional checks as a followup to flutter/packages#6446 *List which issues are fixed by this PR. You must list at least one issue.* Related to flutter#145992 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
1 parent 6f0ed15 commit e98839a

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

packages/css_colors/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 1.1.5
22

33
* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.
4+
* Moves flutter_test and test dependencies to dev_dependencies.
45

56
## 1.1.4
67

packages/css_colors/pubspec.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: css_colors
22
description: Defines constant dart:ui Color objects for CSS colors (for use in Flutter code).
33
repository: https://github.com/flutter/packages/tree/main/packages/css_colors
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+css_colors%22
5-
version: 1.1.4
5+
version: 1.1.5
66

77
environment:
88
sdk: ^3.1.0
@@ -11,6 +11,8 @@ environment:
1111
dependencies:
1212
flutter:
1313
sdk: flutter
14+
15+
dev_dependencies:
1416
flutter_test:
1517
sdk: flutter
1618

packages/web_benchmarks/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.2
2+
3+
* Moves flutter_test and test dependencies to dev_dependencies.
4+
15
## 1.2.1
26

37
* Removes a few deprecated API usages.

packages/web_benchmarks/pubspec.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: web_benchmarks
22
description: A benchmark harness for performance-testing Flutter apps in Chrome.
33
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
5-
version: 1.2.1
5+
version: 1.2.2
66

77
environment:
88
sdk: ^3.3.0
@@ -12,18 +12,20 @@ dependencies:
1212
collection: ^1.18.0
1313
flutter:
1414
sdk: flutter
15-
flutter_test:
16-
sdk: flutter
1715
logging: ^1.0.2
1816
meta: ^1.7.0
1917
path: ^1.8.0
2018
process: ">=4.2.4 <6.0.0"
2119
shelf: ^1.2.0
2220
shelf_static: ^1.1.0
23-
test: ^1.19.5
2421
web: ^0.5.0
2522
webkit_inspection_protocol: ^1.0.0
2623

24+
dev_dependencies:
25+
flutter_test:
26+
sdk: flutter
27+
test: ^1.19.5
28+
2729
topics:
2830
- benchmarking
2931
- performance

script/tool/lib/src/pubspec_check_command.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ class PubspecCheckCommand extends PackageLoopingCommand {
556556
}
557557

558558
// Ensure that dev-only dependencies aren't in `dependencies`.
559-
const List<String> devOnlyDependencies = <String>['integration_test'];
559+
const Set<String> devOnlyDependencies = <String>{'integration_test', 'test', 'flutter_test'};
560560
// Non-published packages like pidgeon subpackages are allowed to violate
561561
// the dev only dependencies rule.
562562
if (pubspec.publishTo != 'none') {

script/tool/test/pubspec_check_command_test.dart

+13-4
Original file line numberDiff line numberDiff line change
@@ -1735,15 +1735,19 @@ ${_topicsSection()}
17351735
);
17361736
});
17371737

1738-
test('fails when integration_test is used in non dev dependency',
1738+
test('fails when integration_test, flutter_test or test are used in non dev dependency',
17391739
() async {
17401740
final RepositoryPackage package =
17411741
createFakePackage('a_package', packagesDir, examples: <String>[]);
17421742

17431743
package.pubspecFile.writeAsStringSync('''
17441744
${_headerSection('a_package')}
17451745
${_environmentSection()}
1746-
${_dependenciesSection(<String>['integration_test: \n sdk: flutter'])}
1746+
${_dependenciesSection(<String>[
1747+
'integration_test: \n sdk: flutter',
1748+
'flutter_test: \n sdk: flutter',
1749+
'test: 1.0.0'
1750+
])}
17471751
${_devDependenciesSection()}
17481752
${_topicsSection()}
17491753
''');
@@ -1761,22 +1765,27 @@ ${_topicsSection()}
17611765
containsAllInOrder(<Matcher>[
17621766
contains(
17631767
'The following unexpected non-local dependencies were found:\n'
1768+
' test\n'
17641769
' integration_test\n'
1770+
' flutter_test\n'
17651771
'Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies '
17661772
'for more information and next steps.'),
17671773
]),
17681774
);
17691775
});
17701776

1771-
test('passes when integration_test is used in non published package',
1777+
test('passes when integration_test or flutter_test are used in non published package',
17721778
() async {
17731779
final RepositoryPackage package =
17741780
createFakePackage('a_package', packagesDir, examples: <String>[]);
17751781

17761782
package.pubspecFile.writeAsStringSync('''
17771783
${_headerSection('a_package', publishable: false)}
17781784
${_environmentSection()}
1779-
${_dependenciesSection(<String>['integration_test: \n sdk: flutter'])}
1785+
${_dependenciesSection(<String>[
1786+
'integration_test: \n sdk: flutter',
1787+
'flutter_test: \n sdk: flutter'
1788+
])}
17801789
${_devDependenciesSection()}
17811790
${_topicsSection()}
17821791
''');

0 commit comments

Comments
 (0)