@@ -1611,10 +1611,10 @@ ${_topicsSection()}
1611
1611
output,
1612
1612
containsAllInOrder (< Matcher > [
1613
1613
contains (
1614
- 'The following unexpected non-local dependencies were found:\n '
1615
- ' bad_dependency\n '
1616
- 'Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies '
1617
- 'for more information and next steps.' ),
1614
+ ' The following unexpected non-local dependencies were found:\n '
1615
+ ' bad_dependency\n '
1616
+ ' Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies\n '
1617
+ ' for more information and next steps.' ),
1618
1618
]),
1619
1619
);
1620
1620
});
@@ -1643,10 +1643,10 @@ ${_topicsSection()}
1643
1643
output,
1644
1644
containsAllInOrder (< Matcher > [
1645
1645
contains (
1646
- 'The following unexpected non-local dependencies were found:\n '
1647
- ' bad_dependency\n '
1648
- 'Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies '
1649
- 'for more information and next steps.' ),
1646
+ ' The following unexpected non-local dependencies were found:\n '
1647
+ ' bad_dependency\n '
1648
+ ' Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies\n '
1649
+ ' for more information and next steps.' ),
1650
1650
]),
1651
1651
);
1652
1652
});
@@ -1727,54 +1727,68 @@ ${_topicsSection()}
1727
1727
output,
1728
1728
containsAllInOrder (< Matcher > [
1729
1729
contains (
1730
- 'The following unexpected non-local dependencies were found:\n '
1731
- ' allow_pinned\n '
1732
- 'Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies '
1733
- 'for more information and next steps.' ),
1730
+ ' The following unexpected non-local dependencies were found:\n '
1731
+ ' allow_pinned\n '
1732
+ ' Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies\n '
1733
+ ' for more information and next steps.' ),
1734
1734
]),
1735
1735
);
1736
1736
});
1737
1737
1738
- test ('fails when integration_test, flutter_test or test are used in non dev dependency' ,
1739
- () async {
1740
- final RepositoryPackage package =
1741
- createFakePackage ('a_package' , packagesDir, examples: < String > []);
1742
-
1743
- package.pubspecFile.writeAsStringSync ('''
1738
+ group ('dev dependencies' , () {
1739
+ const List <String > packages = < String > [
1740
+ 'build_runner' ,
1741
+ 'integration_test' ,
1742
+ 'flutter_test' ,
1743
+ 'mockito' ,
1744
+ 'pigeon' ,
1745
+ 'test' ,
1746
+ ];
1747
+ for (final String dependency in packages) {
1748
+ test ('fails when $dependency is used in non dev dependency' ,
1749
+ () async {
1750
+ final RepositoryPackage package = createFakePackage (
1751
+ 'a_package' , packagesDir,
1752
+ examples: < String > []);
1753
+
1754
+ final String version =
1755
+ dependency == 'integration_test' || dependency == 'flutter_test'
1756
+ ? '{ sdk: flutter }'
1757
+ : '1.0.0' ;
1758
+ package.pubspecFile.writeAsStringSync ('''
1744
1759
${_headerSection ('a_package' )}
1745
1760
${_environmentSection ()}
1746
1761
${_dependenciesSection (<String >[
1747
- 'integration_test: \n sdk: flutter' ,
1748
- 'flutter_test: \n sdk: flutter' ,
1749
- 'test: 1.0.0'
1750
- ])}
1762
+ '$dependency : $version ' ,
1763
+ ])}
1751
1764
${_devDependenciesSection ()}
1752
1765
${_topicsSection ()}
1753
1766
''' );
1754
1767
1755
- Error ? commandError;
1756
- final List <String > output = await runCapturingPrint (runner, < String > [
1757
- 'pubspec-check' ,
1758
- ], errorHandler : ( Error e) {
1759
- commandError = e;
1760
- }) ;
1761
-
1762
- expect (commandError, isA < ToolExit >());
1763
- expect (
1764
- output,
1765
- containsAllInOrder ( < Matcher > [
1766
- contains (
1767
- 'The following unexpected non-local dependencies were found: \n '
1768
- ' test \n '
1769
- ' integration_test \n '
1770
- ' flutter_test \n '
1771
- 'Please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#Dependencies '
1772
- 'for more information and next steps.' ),
1773
- ]),
1774
- );
1768
+ Error ? commandError;
1769
+ final List <String > output =
1770
+ await runCapturingPrint (runner, < String > [
1771
+ 'pubspec-check' ,
1772
+ ], errorHandler : ( Error e) {
1773
+ commandError = e ;
1774
+ });
1775
+
1776
+ expect (commandError, isA < ToolExit >());
1777
+ expect (
1778
+ output,
1779
+ containsAllInOrder ( < Matcher > [
1780
+ contains (
1781
+ ' The following dev dependencies were found in the dependencies section: \n '
1782
+ ' $ dependency \n '
1783
+ ' Please move them to dev_dependencies.' ),
1784
+ ]),
1785
+ );
1786
+ });
1787
+ }
1775
1788
});
1776
1789
1777
- test ('passes when integration_test or flutter_test are used in non published package' ,
1790
+ test (
1791
+ 'passes when integration_test or flutter_test are used in non published package' ,
1778
1792
() async {
1779
1793
final RepositoryPackage package =
1780
1794
createFakePackage ('a_package' , packagesDir, examples: < String > []);
0 commit comments