Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions pkg/pub_integration/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ dependencies:
dev_dependencies:
coverage: any # test already depends on it
markdown: ^7.3.0
pubspec_parse: ^1.5.0
shelf: ^1.4.0
test: ^1.16.5
32 changes: 23 additions & 9 deletions pkg/pub_integration/test/publish_rejection_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:path/path.dart' as p;
import 'package:pub_integration/src/fake_credentials.dart';
import 'package:pub_integration/src/fake_test_context_provider.dart';
import 'package:pub_integration/src/pub_tool_client.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';
import 'package:test/test.dart';

void main() {
Expand Down Expand Up @@ -36,10 +38,27 @@ void main() {
test('uses a template', () async {
final tempDir = await Directory.systemTemp.createTemp();
try {
final dependentPackages = {
'lints': '6.0.0',
'path': '1.9.1',
'test': '1.99.0',
// create templated package
final pkgDir = p.join(tempDir.path, 'pkg');
await globalDartTool.create(pkgDir);

// collect dependencies:
final pubspec = Pubspec.parse(
await File(p.join(pkgDir, 'pubspec.yaml')).readAsString());

String extractConstraint(Dependency d) {
if (d is! HostedDependency) {
throw ArgumentError();
}
final v = d.version as VersionRange;
return v.min.toString();
}

final dependentPackages = <String, String>{
...pubspec.dependencies
.map((k, v) => MapEntry(k, extractConstraint(v))),
...pubspec.devDependencies
.map((k, v) => MapEntry(k, extractConstraint(v))),
};
for (final d in dependentPackages.keys) {
final pkgDir = p.join(tempDir.path, d);
Expand All @@ -59,11 +78,6 @@ void main() {
await localDartTool.publish(pkgDir);
}

final pkgName = 'pkg';
final pkgDir = p.join(tempDir.path, pkgName);
// create templated package
await globalDartTool.create(pkgDir);

// customize content to clear publishing warnings
final pubspecFile = File(p.join(pkgDir, 'pubspec.yaml'));
final pubspecContent = await pubspecFile.readAsString();
Expand Down