diff --git a/test/unit/tooling/pub_content_limits_test.dart b/test/unit/tooling/pub_content_limits_test.dart index 1658886cb..22b9171f6 100644 --- a/test/unit/tooling/pub_content_limits_test.dart +++ b/test/unit/tooling/pub_content_limits_test.dart @@ -163,6 +163,18 @@ void main() { }); } + for (final MapEntry(key: name, value: path) in _packages.entries.skip(1)) { + test('fails an oversized $name README', () { + write('$path/README.md', pubContentLimitBytes + 1); + final result = verify(releasePrep: false); + expect(result.exitCode, 1); + expect( + result.stderr, + contains('- $path/README.md is 262145 bytes; pub.dev rejects $name'), + ); + }); + } + test('passes a changelog under the limit', () { write('CHANGELOG.md', pubContentLimitBytes); final result = verify(releasePrep: false); diff --git a/tool/release/pub_content_limits.dart b/tool/release/pub_content_limits.dart index fb63bf590..839a5718e 100644 --- a/tool/release/pub_content_limits.dart +++ b/tool/release/pub_content_limits.dart @@ -19,6 +19,11 @@ const int pubContentWarningBytes = pubContentLimitBytes * 9 ~/ 10; /// The content files of package [name] at [packagePath], relative to the /// repository root, that pub.dev reads: `README.md`, `CHANGELOG.md`, `LICENSE` /// and the first example file its Example tab would show. +/// +/// Candidates are chosen by existence on disk. `.pubignore` is not consulted +/// (it is gitignore syntax, and no candidate is ignored today), so a +/// pub-ignored higher-priority example would make this check size a file that +/// pub.dev never shows. List pubContentFiles( Directory repoRoot, String packagePath,