Merge branch 'cherry-pick-for-2.15.0'
Ensures that commit won't disappear from git in the future.
diff --git a/lib/src/command/global_run.dart b/lib/src/command/global_run.dart
index b8f7f1b..71e0a9d 100644
--- a/lib/src/command/global_run.dart
+++ b/lib/src/command/global_run.dart
@@ -17,8 +17,7 @@
String get name => 'run';
@override
String get description =>
- 'Run an executable from a globally activated package.\n'
- "NOTE: We are currently optimizing this command's startup time.";
+ 'Run an executable from a globally activated package.';
@override
String get argumentsDescription => '<package>:<executable> [args...]';
@override
diff --git a/lib/src/ignore.dart b/lib/src/ignore.dart
index ade58d0..fbd93e8 100644
--- a/lib/src/ignore.dart
+++ b/lib/src/ignore.dart
@@ -94,7 +94,7 @@
/// [1]: https://git-scm.com/docs/gitignore
/// [2]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreignoreCase
Ignore(
- Iterable<String> patterns, {
+ List<String> patterns, {
bool ignoreCase = false,
void Function(String pattern, FormatException exception)? onInvalidPattern,
}) : _rules = _parseIgnorePatterns(
diff --git a/lib/src/rate_limited_scheduler.dart b/lib/src/rate_limited_scheduler.dart
index daeb76f..2d301d3 100644
--- a/lib/src/rate_limited_scheduler.dart
+++ b/lib/src/rate_limited_scheduler.dart
@@ -92,7 +92,9 @@
// become uncaught.
//
// They will still show up for other listeners of the future.
- await completer.future.catchError((_) {});
+ try {
+ await completer.future;
+ } catch (_) {}
}
/// Calls [callback] with a function that can pre-schedule jobs.
diff --git a/lib/src/validator/gitignore.dart b/lib/src/validator/gitignore.dart
index 7770b57..78bf9aa 100644
--- a/lib/src/validator/gitignore.dart
+++ b/lib/src/validator/gitignore.dart
@@ -46,8 +46,10 @@
beneath: beneath,
listDir: (dir) {
var contents = Directory(resolve(dir)).listSync();
- return contents.map((entity) =>
- p.posix.joinAll(p.split(p.relative(entity.path, from: root))));
+ return contents
+ .where((e) => !(linkExists(e.path) && dirExists(e.path)))
+ .map((entity) => p.posix
+ .joinAll(p.split(p.relative(entity.path, from: root))));
},
ignoreForDir: (dir) {
final gitIgnore = resolve('$dir/.gitignore');
diff --git a/test/add/common/add_test.dart b/test/add/common/add_test.dart
index 51d5b71..e124be8 100644
--- a/test/add/common/add_test.dart
+++ b/test/add/common/add_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io' show File;
import 'package:path/path.dart' as p;
diff --git a/test/add/common/invalid_options.dart b/test/add/common/invalid_options.dart
index 17262d2..0b60ed8 100644
--- a/test/add/common/invalid_options.dart
+++ b/test/add/common/invalid_options.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -42,7 +40,7 @@
// Make the default server serve errors. Only the custom server should
// be accessed.
await serveNoPackages();
- globalPackageServer.serveErrors();
+ globalPackageServer!.serveErrors();
final server = await PackageServer.start((builder) {
builder.serve('foo', '1.2.3');
@@ -79,7 +77,7 @@
// Make the default server serve errors. Only the custom server should
// be accessed.
await serveNoPackages();
- globalPackageServer.serveErrors();
+ globalPackageServer!.serveErrors();
final server = await PackageServer.start((builder) {
builder.serve('foo', '1.2.3');
diff --git a/test/add/common/version_constraint_test.dart b/test/add/common/version_constraint_test.dart
index 22df8bc..d865727 100644
--- a/test/add/common/version_constraint_test.dart
+++ b/test/add/common/version_constraint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/add/common/version_resolution_test.dart b/test/add/common/version_resolution_test.dart
index a6ad690..4bd355b 100644
--- a/test/add/common/version_resolution_test.dart
+++ b/test/add/common/version_resolution_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -26,7 +24,7 @@
/// foo's package creator releases a newer version of foo, and we
/// want to test that this is what the user gets when they run
/// pub add foo.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.5.0');
builder.serve('foo', '3.1.0');
builder.serve('foo', '2.5.0');
@@ -51,7 +49,7 @@
await d.appDir({'bar': '1.0.0'}).create();
await pubGet();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '4.0.0');
builder.serve('foo', '2.0.0');
});
@@ -75,7 +73,7 @@
await d.appDir({'bar': '^1.0.0'}).create();
await pubGet();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '5.0.0');
builder.serve('foo', '4.0.0');
builder.serve('foo', '2.0.0');
diff --git a/test/add/git/git_test.dart b/test/add/git/git_test.dart
index b120e38..2577af8 100644
--- a/test/add/git/git_test.dart
+++ b/test/add/git/git_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/add/git/ref_test.dart b/test/add/git/ref_test.dart
index fadd80a..11dfc0b 100644
--- a/test/add/git/ref_test.dart
+++ b/test/add/git/ref_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/add/git/subdir_test.dart b/test/add/git/subdir_test.dart
index 3bf381a..0f78069 100644
--- a/test/add/git/subdir_test.dart
+++ b/test/add/git/subdir_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/add/hosted/non_default_pub_server_test.dart b/test/add/hosted/non_default_pub_server_test.dart
index 33b6753..fbe966e 100644
--- a/test/add/hosted/non_default_pub_server_test.dart
+++ b/test/add/hosted/non_default_pub_server_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/add/path/absolute_path_test.dart b/test/add/path/absolute_path_test.dart
index dc74638..0811bea 100644
--- a/test/add/path/absolute_path_test.dart
+++ b/test/add/path/absolute_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/add/path/relative_path_test.dart b/test/add/path/relative_path_test.dart
index 9d443e8..8fa1932 100644
--- a/test/add/path/relative_path_test.dart
+++ b/test/add/path/relative_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io' show Platform;
import 'package:pub/src/exit_codes.dart' as exit_codes;
diff --git a/test/add/sdk/sdk_test.dart b/test/add/sdk/sdk_test.dart
index 1ded16e..25995e3 100644
--- a/test/add/sdk/sdk_test.dart
+++ b/test/add/sdk/sdk_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/add/adds_latest_matching_version_test.dart b/test/cache/add/adds_latest_matching_version_test.dart
index d7e26c4..0e78b12 100644
--- a/test/cache/add/adds_latest_matching_version_test.dart
+++ b/test/cache/add/adds_latest_matching_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:test/test.dart';
diff --git a/test/cache/add/adds_latest_version_test.dart b/test/cache/add/adds_latest_version_test.dart
index 6a8b795..6e196f6 100644
--- a/test/cache/add/adds_latest_version_test.dart
+++ b/test/cache/add/adds_latest_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/add/all_adds_all_matching_versions_test.dart b/test/cache/add/all_adds_all_matching_versions_test.dart
index bfffa7f..9dfb3c7 100644
--- a/test/cache/add/all_adds_all_matching_versions_test.dart
+++ b/test/cache/add/all_adds_all_matching_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/add/all_with_some_versions_present_test.dart b/test/cache/add/all_with_some_versions_present_test.dart
index da4da98..861ac4c 100644
--- a/test/cache/add/all_with_some_versions_present_test.dart
+++ b/test/cache/add/all_with_some_versions_present_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/add/already_cached_test.dart b/test/cache/add/already_cached_test.dart
index 9bf8df3..ac244dc 100644
--- a/test/cache/add/already_cached_test.dart
+++ b/test/cache/add/already_cached_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/add/bad_version_test.dart b/test/cache/add/bad_version_test.dart
index 8d5d2e1..4e93331 100644
--- a/test/cache/add/bad_version_test.dart
+++ b/test/cache/add/bad_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/add/missing_package_arg_test.dart b/test/cache/add/missing_package_arg_test.dart
index 426b0d8..456342b 100644
--- a/test/cache/add/missing_package_arg_test.dart
+++ b/test/cache/add/missing_package_arg_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/add/no_matching_version_test.dart b/test/cache/add/no_matching_version_test.dart
index d395f29..4b4455c 100644
--- a/test/cache/add/no_matching_version_test.dart
+++ b/test/cache/add/no_matching_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/cache/add/package_not_found_test.dart b/test/cache/add/package_not_found_test.dart
index 4179319..91f3f3e 100644
--- a/test/cache/add/package_not_found_test.dart
+++ b/test/cache/add/package_not_found_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/add/unexpected_arguments_test.dart b/test/cache/add/unexpected_arguments_test.dart
index 7ec0f30..1e4fa54 100644
--- a/test/cache/add/unexpected_arguments_test.dart
+++ b/test/cache/add/unexpected_arguments_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/clean_test.dart b/test/cache/clean_test.dart
index 1ba2ac7..b03c0c8 100644
--- a/test/cache/clean_test.dart
+++ b/test/cache/clean_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/cache/list_test.dart b/test/cache/list_test.dart
index 9d8b9f3..a2c26a4 100644
--- a/test/cache/list_test.dart
+++ b/test/cache/list_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/cache/repair/empty_cache_test.dart b/test/cache/repair/empty_cache_test.dart
index 679e32a..13d68cc 100644
--- a/test/cache/repair/empty_cache_test.dart
+++ b/test/cache/repair/empty_cache_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/cache/repair/git_test.dart b/test/cache/repair/git_test.dart
index abb0ab7..262343a 100644
--- a/test/cache/repair/git_test.dart
+++ b/test/cache/repair/git_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/cache/repair/handles_corrupted_binstub_test.dart b/test/cache/repair/handles_corrupted_binstub_test.dart
index b1c3556..9991ec1 100644
--- a/test/cache/repair/handles_corrupted_binstub_test.dart
+++ b/test/cache/repair/handles_corrupted_binstub_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/repair/handles_corrupted_global_lockfile_test.dart b/test/cache/repair/handles_corrupted_global_lockfile_test.dart
index 3952871..9a9af05 100644
--- a/test/cache/repair/handles_corrupted_global_lockfile_test.dart
+++ b/test/cache/repair/handles_corrupted_global_lockfile_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/cache/repair/handles_failure_test.dart b/test/cache/repair/handles_failure_test.dart
index 8016d30..471bcf8 100644
--- a/test/cache/repair/handles_failure_test.dart
+++ b/test/cache/repair/handles_failure_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -21,7 +19,7 @@
// Set up a cache with some packages.
await d.dir(cachePath, [
d.dir('hosted', [
- d.dir('localhost%58${globalServer.port}', [
+ d.dir('localhost%58${globalServer!.port}', [
d.dir('foo-1.2.3',
[d.libPubspec('foo', '1.2.3'), d.file('broken.txt')]),
d.dir('foo-1.2.4',
diff --git a/test/cache/repair/handles_orphaned_binstub_test.dart b/test/cache/repair/handles_orphaned_binstub_test.dart
index 4954121..9c4e74a 100644
--- a/test/cache/repair/handles_orphaned_binstub_test.dart
+++ b/test/cache/repair/handles_orphaned_binstub_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/repair/hosted.dart b/test/cache/repair/hosted.dart
index 23d839b..97c8167 100644
--- a/test/cache/repair/hosted.dart
+++ b/test/cache/repair/hosted.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -27,7 +25,7 @@
// Set up a cache with some broken packages.
await d.dir(cachePath, [
d.dir('hosted', [
- d.dir('localhost%58${globalServer.port}', [
+ d.dir('localhost%58${globalServer!.port}', [
d.dir('foo-1.2.3',
[d.libPubspec('foo', '1.2.3'), d.file('broken.txt')]),
d.dir('foo-1.2.5',
@@ -66,7 +64,7 @@
// Set up a cache with some broken packages.
await d.dir(cachePath, [
d.dir('hosted', [
- d.dir('localhost%58${globalServer.port}', [
+ d.dir('localhost%58${globalServer!.port}', [
d.dir('bar-1.2.4', [d.file('broken.txt')]),
d.dir('foo-1.2.3', [d.file('broken.txt')]),
d.dir('foo-1.2.5', [d.file('broken.txt')]),
@@ -102,7 +100,7 @@
// Set up a cache with some broken packages.
await d.dir(cachePath, [
d.dir('hosted', [
- d.dir('localhost%58${globalServer.port}', [
+ d.dir('localhost%58${globalServer!.port}', [
d.dir('bar-1.2.4', [d.file('pubspec.yaml', '{')]),
d.dir('foo-1.2.3', [d.file('pubspec.yaml', '{')]),
d.dir('foo-1.2.5', [d.file('pubspec.yaml', '{')]),
diff --git a/test/cache/repair/recompiles_snapshots_test.dart b/test/cache/repair/recompiles_snapshots_test.dart
index 698e148..89b3575 100644
--- a/test/cache/repair/recompiles_snapshots_test.dart
+++ b/test/cache/repair/recompiles_snapshots_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/cache/repair/updates_binstubs_test.dart b/test/cache/repair/updates_binstubs_test.dart
index bfb6400..1cd848b 100644
--- a/test/cache/repair/updates_binstubs_test.dart
+++ b/test/cache/repair/updates_binstubs_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/dependency_override_test.dart b/test/dependency_override_test.dart
index 3cac645..2ea5abc 100644
--- a/test/dependency_override_test.dart
+++ b/test/dependency_override_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/deps/executables_test.dart b/test/deps/executables_test.dart
index 978cc24..ea864fd 100644
--- a/test/deps/executables_test.dart
+++ b/test/deps/executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import '../descriptor.dart' as d;
import '../golden_file.dart';
import '../test_pub.dart';
diff --git a/test/deps_test.dart b/test/deps_test.dart
index 2d59ef8..207e8e7 100644
--- a/test/deps_test.dart
+++ b/test/deps_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
diff --git a/test/descriptor.dart b/test/descriptor.dart
index 3eee5d1..7a592db 100644
--- a/test/descriptor.dart
+++ b/test/descriptor.dart
@@ -2,12 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
/// Pub-specific test descriptors.
import 'dart:convert';
-import 'package:meta/meta.dart';
import 'package:oauth2/oauth2.dart' as oauth2;
import 'package:path/path.dart' as p;
import 'package:pub/src/language_version.dart';
@@ -27,11 +24,11 @@
export 'descriptor/tar.dart';
/// Creates a new [GitRepoDescriptor] with [name] and [contents].
-GitRepoDescriptor git(String name, [Iterable<Descriptor> contents]) =>
+GitRepoDescriptor git(String name, [List<Descriptor>? contents]) =>
GitRepoDescriptor(name, contents ?? <Descriptor>[]);
/// Creates a new [TarFileDescriptor] with [name] and [contents].
-TarFileDescriptor tar(String name, [Iterable<Descriptor> contents]) =>
+TarFileDescriptor tar(String name, [List<Descriptor>? contents]) =>
TarFileDescriptor(name, contents ?? <Descriptor>[]);
/// Describes a package that passes all validation.
@@ -67,14 +64,14 @@
///
/// [contents] may contain [Future]s that resolve to serializable objects,
/// which may in turn contain [Future]s recursively.
-Descriptor pubspec(Map<String, Object> contents) => YamlDescriptor(
+Descriptor pubspec(Map<String, Object?> contents) => YamlDescriptor(
'pubspec.yaml',
yaml({
...contents,
// TODO: Copy-pasting this into all call-sites, or use d.libPubspec
'environment': {
'sdk': '>=0.1.2 <1.0.0',
- ...contents['environment'] as Map ?? {},
+ ...(contents['environment'] ?? {}) as Map,
},
}),
);
@@ -84,8 +81,8 @@
/// Describes a file named `pubspec.yaml` for an application package with the
/// given [dependencies].
-Descriptor appPubspec([Map dependencies]) {
- var map = <String, dynamic>{
+Descriptor appPubspec([Map? dependencies]) {
+ var map = <String, Object>{
'name': 'myapp',
'environment': {
'sdk': '>=0.1.2 <1.0.0',
@@ -100,7 +97,7 @@
/// constraint on that version, otherwise it adds an SDK constraint allowing
/// the current SDK version.
Descriptor libPubspec(String name, String version,
- {Map deps, Map devDeps, String sdk}) {
+ {Map? deps, Map? devDeps, String? sdk}) {
var map = packageMap(name, version, deps, devDeps);
if (sdk != null) {
map['environment'] = {'sdk': sdk};
@@ -112,7 +109,7 @@
/// Describes a directory named `lib` containing a single dart file named
/// `<name>.dart` that contains a line of Dart code.
-Descriptor libDir(String name, [String code]) {
+Descriptor libDir(String name, [String? code]) {
// Default to printing the name if no other code was given.
code ??= name;
return dir('lib', [file('$name.dart', 'main() => "$code";')]);
@@ -130,8 +127,8 @@
/// If [repoName] is not given it is assumed to be equal to [packageName].
Descriptor gitPackageRevisionCacheDir(
String packageName, {
- int modifier,
- String repoName,
+ int? modifier,
+ String? repoName,
}) {
repoName = repoName ?? packageName;
var value = packageName;
@@ -159,7 +156,7 @@
/// validated since they will often lack the dependencies section that the
/// real pubspec being compared against has. You usually only need to pass
/// `true` for this if you plan to call [create] on the resulting descriptor.
-Descriptor cacheDir(Map packages, {int port, bool includePubspecs = false}) {
+Descriptor cacheDir(Map packages, {int? port, bool includePubspecs = false}) {
var contents = <Descriptor>[];
packages.forEach((name, versions) {
if (versions is! List) versions = [versions];
@@ -180,9 +177,9 @@
///
/// If [port] is passed, it's used as the port number of the local hosted server
/// that this cache represents. It defaults to [globalServer.port].
-Descriptor hostedCache(Iterable<Descriptor> contents, {int port}) {
+Descriptor hostedCache(Iterable<Descriptor> contents, {int? port}) {
return dir(cachePath, [
- dir('hosted', [dir('localhost%58${port ?? globalServer.port}', contents)])
+ dir('hosted', [dir('localhost%58${port ?? globalServer?.port}', contents)])
]);
}
@@ -190,7 +187,7 @@
/// credentials. The URL "/token" on [server] will be used as the token
/// endpoint for refreshing the access token.
Descriptor credentialsFile(PackageServer server, String accessToken,
- {String refreshToken, DateTime expiration}) {
+ {String? refreshToken, DateTime? expiration}) {
return dir(
configPath,
[
@@ -208,7 +205,7 @@
}
Descriptor legacyCredentialsFile(PackageServer server, String accessToken,
- {String refreshToken, DateTime expiration}) {
+ {String? refreshToken, DateTime? expiration}) {
return dir(
cachePath,
[
@@ -228,8 +225,8 @@
String _credentialsFileContent(
PackageServer server,
String accessToken, {
- String refreshToken,
- DateTime expiration,
+ String? refreshToken,
+ DateTime? expiration,
}) =>
oauth2.Credentials(
accessToken,
@@ -245,14 +242,12 @@
/// Describes the file in the system cache that contains credentials for
/// third party hosted pub servers.
Descriptor tokensFile([Map<String, dynamic> contents = const {}]) {
- return dir(configPath, [
- file('pub-tokens.json', contents != null ? jsonEncode(contents) : null)
- ]);
+ return dir(configPath, [file('pub-tokens.json', jsonEncode(contents))]);
}
/// Describes the application directory, containing only a pubspec specifying
/// the given [dependencies].
-DirectoryDescriptor appDir([Map dependencies]) =>
+DirectoryDescriptor appDir([Map? dependencies]) =>
dir(appPath, [appPubspec(dependencies)]);
/// Describes a `.packages` file.
@@ -266,7 +261,7 @@
/// entries (one per key in [dependencies]), each with a path that contains
/// either the version string (for a reference to the pub cache) or a
/// path to a path dependency, relative to the application directory.
-Descriptor packagesFile([Map<String, String> dependencies]) =>
+Descriptor packagesFile(Map<String, String> dependencies) =>
PackagesFileDescriptor(dependencies);
/// Describes a `.dart_tools/package_config.json` file.
@@ -285,10 +280,10 @@
/// Create a [PackageConfigEntry] which assumes package with [name] is either
/// a cached package with given [version] or a path dependency at given [path].
PackageConfigEntry packageConfigEntry({
- @required String name,
- String version,
- String path,
- String languageVersion,
+ required String name,
+ String? version,
+ String? path,
+ String? languageVersion,
}) {
if (version != null && path != null) {
throw ArgumentError.value(
@@ -300,7 +295,7 @@
}
Uri rootUri;
if (version != null) {
- rootUri = p.toUri(globalPackageServer.pathInCache(name, version));
+ rootUri = p.toUri(globalPackageServer!.pathInCache(name, version));
} else {
rootUri = p.toUri(p.join('..', path));
}
diff --git a/test/descriptor/git.dart b/test/descriptor/git.dart
index 56cd59f..edfc7bd 100644
--- a/test/descriptor/git.dart
+++ b/test/descriptor/git.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'package:path/path.dart' as path;
@@ -17,7 +15,7 @@
/// Creates the Git repository and commits the contents.
@override
- Future create([String parent]) async {
+ Future create([String? parent]) async {
await super.create(parent);
await _runGitCommands(parent, [
['init'],
@@ -35,7 +33,7 @@
/// the previous structure to the Git repo.
///
/// [parent] defaults to [sandbox].
- Future commit([String parent]) async {
+ Future commit([String? parent]) async {
await super.create(parent);
await _runGitCommands(parent, [
['add', '.'],
@@ -47,7 +45,7 @@
/// referred to by [ref].
///
/// [parent] defaults to [sandbox].
- Future<String> revParse(String ref, [String parent]) async {
+ Future<String> revParse(String ref, [String? parent]) async {
var output = await _runGit(['rev-parse', ref], parent);
return output[0];
}
@@ -55,9 +53,9 @@
/// Runs a Git command in this repository.
///
/// [parent] defaults to [sandbox].
- Future runGit(List<String> args, [String parent]) => _runGit(args, parent);
+ Future runGit(List<String> args, [String? parent]) => _runGit(args, parent);
- Future<List<String>> _runGit(List<String> args, String parent) {
+ Future<List<String>> _runGit(List<String> args, String? parent) {
// Explicitly specify the committer information. Git needs this to commit
// and we don't want to rely on the buildbots having this already set up.
var environment = {
@@ -72,7 +70,7 @@
environment: environment);
}
- Future _runGitCommands(String parent, List<List<String>> commands) async {
+ Future _runGitCommands(String? parent, List<List<String>> commands) async {
for (var command in commands) {
await _runGit(command, parent);
}
diff --git a/test/descriptor/packages.dart b/test/descriptor/packages.dart
index 2a23e40..de52a80 100644
--- a/test/descriptor/packages.dart
+++ b/test/descriptor/packages.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async' show Future;
import 'dart:convert' show JsonEncoder, json, utf8;
import 'dart:io' show File;
@@ -25,7 +23,7 @@
/// Describes a `.packages` file and its contents.
class PackagesFileDescriptor extends Descriptor {
/// A map from package names to either version strings or path to the package.
- final Map<String, String> _dependencies;
+ final Map<String, String>? _dependencies;
/// Describes a `.packages` file with the given dependencies.
///
@@ -34,11 +32,12 @@
PackagesFileDescriptor([this._dependencies]) : super('.packages');
@override
- Future create([String parent]) {
+ Future create([String? parent]) {
var contents = const <int>[];
- if (_dependencies != null) {
+ var dependencies = _dependencies;
+ if (dependencies != null) {
var mapping = <String, Uri>{};
- _dependencies.forEach((package, version) {
+ dependencies.forEach((package, version) {
String packagePath;
if (_isSemver(version)) {
// It's a cache reference.
@@ -58,7 +57,7 @@
}
@override
- Future validate([String parent]) async {
+ Future validate([String? parent]) async {
var fullPath = p.join(parent ?? sandbox, name);
if (!await File(fullPath).exists()) {
fail("File not found: '$fullPath'.");
@@ -68,14 +67,16 @@
var map = packages_file.parse(bytes, Uri.parse(_base));
- for (var package in _dependencies.keys) {
+ var dependencies = _dependencies!;
+
+ for (var package in dependencies.keys) {
if (!map.containsKey(package)) {
fail('.packages does not contain $package entry');
}
- var description = _dependencies[package];
+ var description = dependencies[package]!;
if (_isSemver(description)) {
- if (!map[package].path.contains(description)) {
+ if (!map[package]!.path.contains(description)) {
fail('.packages of $package has incorrect version. '
'Expected $description, found location: ${map[package]}.');
}
@@ -90,9 +91,9 @@
}
}
- if (map.length != _dependencies.length) {
+ if (map.length != dependencies.length) {
for (var key in map.keys) {
- if (!_dependencies.containsKey(key)) {
+ if (!dependencies.containsKey(key)) {
fail('.packages file contains unexpected entry: $key');
}
}
@@ -128,7 +129,7 @@
: super('.dart_tool/package_config.json');
@override
- Future<void> create([String parent]) async {
+ Future<void> create([String? parent]) async {
final packageConfigFile = File(p.join(parent ?? sandbox, name));
await packageConfigFile.parent.create();
await packageConfigFile.writeAsString(
@@ -137,13 +138,13 @@
}
@override
- Future<void> validate([String parent]) async {
+ Future<void> validate([String? parent]) async {
final packageConfigFile = p.join(parent ?? sandbox, name);
if (!await File(packageConfigFile).exists()) {
fail("File not found: '$packageConfigFile'.");
}
- Map<String, Object> rawJson = json.decode(
+ Map<String, dynamic> rawJson = json.decode(
await File(packageConfigFile).readAsString(),
);
PackageConfig config;
diff --git a/test/descriptor/tar.dart b/test/descriptor/tar.dart
index 1c4f89f..2a3488f 100644
--- a/test/descriptor/tar.dart
+++ b/test/descriptor/tar.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:io';
@@ -23,7 +21,7 @@
/// Creates the files and directories within this tar file, then archives
/// them, compresses them, and saves the result to [parentDir].
@override
- Future create([String parent]) {
+ Future create([String? parent]) {
return withTempDir((tempDir) async {
await Future.wait(contents.map((entry) => entry.create(tempDir)));
@@ -41,7 +39,7 @@
/// Validates that the `.tar.gz` file at [path] contains the expected
/// contents.
@override
- Future validate([String parent]) {
+ Future validate([String? parent]) {
throw UnimplementedError('TODO(nweiz): implement this');
}
diff --git a/test/descriptor/yaml.dart b/test/descriptor/yaml.dart
index 086da84..6840041 100644
--- a/test/descriptor/yaml.dart
+++ b/test/descriptor/yaml.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async' show Future;
import 'dart:convert' show utf8;
import 'dart:io';
@@ -29,7 +27,7 @@
Stream.fromIterable([utf8.encode(_contents)]);
@override
- Future validate([String parent]) async {
+ Future validate([String? parent]) async {
var fullPath = p.join(parent ?? sandbox, name);
if (!await File(fullPath).exists()) {
fail("File not found: '$fullPath'.");
diff --git a/test/descriptor_server.dart b/test/descriptor_server.dart
index a023518..973a49c 100644
--- a/test/descriptor_server.dart
+++ b/test/descriptor_server.dart
@@ -2,10 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
+import 'package:collection/collection.dart' show IterableExtension;
import 'package:path/path.dart' as p;
import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as shelf_io;
@@ -17,26 +16,27 @@
///
/// `null` if there's no global server in use. This can be set to replace the
/// existing global server.
-DescriptorServer get globalServer => _globalServer;
-set globalServer(DescriptorServer value) {
- if (_globalServer == null) {
+DescriptorServer? get globalServer => _globalServer;
+set globalServer(DescriptorServer? value) {
+ var server = _globalServer;
+ if (server == null) {
addTearDown(() {
_globalServer = null;
});
} else {
- expect(_globalServer.close(), completes);
+ expect(server.close(), completes);
}
_globalServer = value;
}
-DescriptorServer _globalServer;
+DescriptorServer? _globalServer;
/// Creates a global [DescriptorServer] to serve [contents] as static files.
///
/// This server will exist only for the duration of the pub run. It's accessible
/// via [server]. Subsequent calls to [serve] replace the previous server.
-Future serve([List<d.Descriptor> contents]) async {
+Future serve([List<d.Descriptor> contents = const []]) async {
globalServer = (await DescriptorServer.start())..contents.addAll(contents);
}
@@ -75,11 +75,11 @@
DescriptorServer._(this._server) : _baseDir = d.dir('serve-dir', []) {
_server.mount((request) async {
final pathWithInitialSlash = '/${request.url.path}';
- final key = extraHandlers.keys.firstWhere((pattern) {
+ final key = extraHandlers.keys.firstWhereOrNull((pattern) {
final match = pattern.matchAsPrefix(pathWithInitialSlash);
return match != null && match.end == pathWithInitialSlash.length;
- }, orElse: () => null);
- if (key != null) return extraHandlers[key](request);
+ });
+ if (key != null) return extraHandlers[key]!(request);
var path = p.posix.fromUri(request.url.path);
requestedPaths.add(path);
@@ -114,12 +114,12 @@
var completer = Completer<Stream<T>>();
var controller = StreamController<T>(sync: true);
- StreamSubscription subscription;
+ late StreamSubscription subscription;
subscription = stream.listen((value) {
// We got a value, so the stream is valid.
if (!completer.isCompleted) completer.complete(controller.stream);
controller.add(value);
- }, onError: (error, [StackTrace stackTrace]) {
+ }, onError: (error, [StackTrace? stackTrace]) {
// If the error came after values, it's OK.
if (completer.isCompleted) {
controller.addError(error, stackTrace);
diff --git a/test/dev_dependency_test.dart b/test/dev_dependency_test.dart
index 471f53c..88f321b 100644
--- a/test/dev_dependency_test.dart
+++ b/test/dev_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import 'descriptor.dart' as d;
diff --git a/test/directory_option_test.dart b/test/directory_option_test.dart
index 541ddd4..2865a69 100644
--- a/test/directory_option_test.dart
+++ b/test/directory_option_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:path/path.dart' as p;
@@ -20,8 +18,8 @@
..serve('foo', '1.0.0')
..serve('foo', '0.1.2')
..serve('bar', '1.2.3'));
- await credentialsFile(globalPackageServer, 'access token').create();
- globalPackageServer
+ await credentialsFile(globalPackageServer!, 'access token').create();
+ globalPackageServer!
.extraHandlers[RegExp('/api/packages/test_pkg/uploaders')] = (request) {
return shelf.Response.ok(
jsonEncode({
diff --git a/test/downgrade/does_not_show_other_versions_test.dart b/test/downgrade/does_not_show_other_versions_test.dart
index 485debb..ca872c8 100644
--- a/test/downgrade/does_not_show_other_versions_test.dart
+++ b/test/downgrade/does_not_show_other_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/downgrade/doesnt_change_git_dependencies_test.dart b/test/downgrade/doesnt_change_git_dependencies_test.dart
index 41f0a51..1450af5 100644
--- a/test/downgrade/doesnt_change_git_dependencies_test.dart
+++ b/test/downgrade/doesnt_change_git_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/downgrade/dry_run_does_not_apply_changes_test.dart b/test/downgrade/dry_run_does_not_apply_changes_test.dart
index 765cb35..ebe2dbf 100644
--- a/test/downgrade/dry_run_does_not_apply_changes_test.dart
+++ b/test/downgrade/dry_run_does_not_apply_changes_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/downgrade/unlock_if_necessary_test.dart b/test/downgrade/unlock_if_necessary_test.dart
index b8aa83e..eac39a8 100644
--- a/test/downgrade/unlock_if_necessary_test.dart
+++ b/test/downgrade/unlock_if_necessary_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -24,7 +22,7 @@
await d.appPackagesFile({'foo': '2.0.0', 'foo_dep': '2.0.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '1.0.0', deps: {'foo_dep': '<2.0.0'});
builder.serve('foo_dep', '1.0.0');
});
diff --git a/test/downgrade/unlock_single_package_test.dart b/test/downgrade/unlock_single_package_test.dart
index 73c3467..8997ba2 100644
--- a/test/downgrade/unlock_single_package_test.dart
+++ b/test/downgrade/unlock_single_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -21,7 +19,7 @@
await pubGet();
await d.appPackagesFile({'foo': '2.1.0', 'bar': '2.1.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '1.0.0', deps: {'bar': 'any'});
builder.serve('bar', '1.0.0');
});
@@ -29,7 +27,7 @@
await pubDowngrade(args: ['bar']);
await d.appPackagesFile({'foo': '2.1.0', 'bar': '2.1.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '2.0.0', deps: {'bar': 'any'});
builder.serve('bar', '2.0.0');
});
diff --git a/test/embedding/embedding_test.dart b/test/embedding/embedding_test.dart
index b5cf8bd..20e127e 100644
--- a/test/embedding/embedding_test.dart
+++ b/test/embedding/embedding_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'dart:io';
@@ -16,14 +14,14 @@
const _command_runner = 'tool/test-bin/pub_command_runner.dart';
-String snapshot;
+late String snapshot;
/// Runs `dart tool/test-bin/pub_command_runner.dart [args]` and appends the output to [buffer].
Future<void> runEmbeddingToBuffer(
List<String> args,
StringBuffer buffer, {
- String workingDirextory,
- Map<String, String> environment,
+ String? workingDirectory,
+ Map<String, String>? environment,
dynamic exitCode = 0,
}) async {
final process = await TestProcess.start(
@@ -33,7 +31,7 @@
...getPubTestEnvironment(),
...?environment,
},
- workingDirectory: workingDirextory,
+ workingDirectory: workingDirectory,
);
await process.shouldExit(exitCode);
@@ -53,15 +51,15 @@
/// next section in golden file.
Future<void> runEmbedding(
List<String> args, {
- String workingDirextory,
- Map<String, String> environment,
+ String? workingDirextory,
+ Map<String, String>? environment,
dynamic exitCode = 0,
}) async {
final buffer = StringBuffer();
await runEmbeddingToBuffer(
args,
buffer,
- workingDirextory: workingDirextory,
+ workingDirectory: workingDirextory,
environment: environment,
exitCode: exitCode,
);
@@ -136,7 +134,7 @@
await runEmbeddingToBuffer(
['pub', 'get'],
buffer,
- workingDirextory: app.io.path,
+ workingDirectory: app.io.path,
environment: {...getPubTestEnvironment(), '_PUB_LOG_ANALYTICS': 'true'},
);
final analytics = buffer
diff --git a/test/embedding/get_executable_for_command_test.dart b/test/embedding/get_executable_for_command_test.dart
index 7667e12..611f5ef 100644
--- a/test/embedding/get_executable_for_command_test.dart
+++ b/test/embedding/get_executable_for_command_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' show separator;
@@ -23,7 +21,7 @@
executable,
packageConfig,
errorMessage,
- CommandResolutionIssue issue,
+ CommandResolutionIssue? issue,
}) async {
final _cachePath = getPubTestEnvironment()['PUB_CACHE'];
final oldVerbosity = log.verbosity;
diff --git a/test/get/dry_run_does_not_apply_changes_test.dart b/test/get/dry_run_does_not_apply_changes_test.dart
index 1879f51..27969ae 100644
--- a/test/get/dry_run_does_not_apply_changes_test.dart
+++ b/test/get/dry_run_does_not_apply_changes_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/get/flutter_constraint_upper_bound_ignored_test.dart b/test/get/flutter_constraint_upper_bound_ignored_test.dart
index 9fc833c..7fd2edc 100644
--- a/test/get/flutter_constraint_upper_bound_ignored_test.dart
+++ b/test/get/flutter_constraint_upper_bound_ignored_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/gets_in_example_folder_test.dart b/test/get/gets_in_example_folder_test.dart
index d7f6c57..04f9d47 100644
--- a/test/get/gets_in_example_folder_test.dart
+++ b/test/get/gets_in_example_folder_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.11
-
import 'dart:io';
import 'package:path/path.dart' as p;
diff --git a/test/get/git/check_out_and_upgrade_test.dart b/test/get/git/check_out_and_upgrade_test.dart
index 846859b..42044af 100644
--- a/test/get/git/check_out_and_upgrade_test.dart
+++ b/test/get/git/check_out_and_upgrade_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/check_out_branch_test.dart b/test/get/git/check_out_branch_test.dart
index 0b58abf..104c8b9 100644
--- a/test/get/git/check_out_branch_test.dart
+++ b/test/get/git/check_out_branch_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/check_out_revision_test.dart b/test/get/git/check_out_revision_test.dart
index eed9f01..2428d7c 100644
--- a/test/get/git/check_out_revision_test.dart
+++ b/test/get/git/check_out_revision_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/check_out_test.dart b/test/get/git/check_out_test.dart
index 194e980..f3caaa2 100644
--- a/test/get/git/check_out_test.dart
+++ b/test/get/git/check_out_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
diff --git a/test/get/git/check_out_transitive_test.dart b/test/get/git/check_out_transitive_test.dart
index b7e71fa..0587c58 100644
--- a/test/get/git/check_out_transitive_test.dart
+++ b/test/get/git/check_out_transitive_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/git/check_out_twice_test.dart b/test/get/git/check_out_twice_test.dart
index f9cebd1..b6de388 100644
--- a/test/get/git/check_out_twice_test.dart
+++ b/test/get/git/check_out_twice_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart b/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
index c5fc4aa..dae234d 100644
--- a/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
+++ b/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/get/git/check_out_with_trailing_slash_test.dart b/test/get/git/check_out_with_trailing_slash_test.dart
index 16dc07c..5838986 100644
--- a/test/get/git/check_out_with_trailing_slash_test.dart
+++ b/test/get/git/check_out_with_trailing_slash_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/clean_invalid_git_repo_cache_test.dart b/test/get/git/clean_invalid_git_repo_cache_test.dart
index 6ea650b..ab386ab 100644
--- a/test/get/git/clean_invalid_git_repo_cache_test.dart
+++ b/test/get/git/clean_invalid_git_repo_cache_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
import 'dart:io';
import 'package:path/path.dart' as path;
@@ -15,11 +14,10 @@
void _invalidateGitCache(String repo) {
final cacheDir =
path.join(d.sandbox, path.joinAll([cachePath, 'git', 'cache']));
- final Directory fooCacheDir =
- Directory(cacheDir).listSync().firstWhere((entity) {
+ final fooCacheDir = Directory(cacheDir).listSync().firstWhere((entity) {
return entity is Directory &&
entity.path.split(Platform.pathSeparator).last.startsWith(repo);
- });
+ }) as Directory;
fooCacheDir.deleteSync(recursive: true);
fooCacheDir.createSync();
diff --git a/test/get/git/dependency_name_match_pubspec_test.dart b/test/get/git/dependency_name_match_pubspec_test.dart
index 2accd62..1545fca 100644
--- a/test/get/git/dependency_name_match_pubspec_test.dart
+++ b/test/get/git/dependency_name_match_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/git/different_repo_name_test.dart b/test/get/git/different_repo_name_test.dart
index 65e37eb..1d8f9c4 100644
--- a/test/get/git/different_repo_name_test.dart
+++ b/test/get/git/different_repo_name_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/doesnt_fetch_if_nothing_changes_test.dart b/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
index ec214d4..3d9f040 100644
--- a/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
+++ b/test/get/git/doesnt_fetch_if_nothing_changes_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/get/git/git_not_installed_test.dart b/test/get/git/git_not_installed_test.dart
index 13a5601..f00d795 100644
--- a/test/get/git/git_not_installed_test.dart
+++ b/test/get/git/git_not_installed_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
@TestOn('linux')
import 'dart:io';
diff --git a/test/get/git/lock_version_test.dart b/test/get/git/lock_version_test.dart
index 1e51d12..40b2708 100644
--- a/test/get/git/lock_version_test.dart
+++ b/test/get/git/lock_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/get/git/locked_revision_without_repo_test.dart b/test/get/git/locked_revision_without_repo_test.dart
index 49c1a11..c00c730 100644
--- a/test/get/git/locked_revision_without_repo_test.dart
+++ b/test/get/git/locked_revision_without_repo_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/get/git/path_test.dart b/test/get/git/path_test.dart
index 8bbd9e7..49607a1 100644
--- a/test/get/git/path_test.dart
+++ b/test/get/git/path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:pub/src/lock_file.dart';
@@ -80,7 +78,7 @@
final lockFile = LockFile.load(
p.join(d.sandbox, appPath, 'pubspec.lock'), SourceRegistry());
- expect(lockFile.packages['sub'].description['path'], 'sub/dir%25',
+ expect(lockFile.packages['sub']!.description['path'], 'sub/dir%25',
reason: 'use uris to specify the path relative to the repo');
});
@@ -124,7 +122,7 @@
final lockFile = LockFile.load(
p.join(d.sandbox, appPath, 'pubspec.lock'), SourceRegistry());
- expect(lockFile.packages['sub'].description['path'], 'sub/dir%25',
+ expect(lockFile.packages['sub']!.description['path'], 'sub/dir%25',
reason: 'use uris to specify the path relative to the repo');
});
diff --git a/test/get/git/require_pubspec_name_test.dart b/test/get/git/require_pubspec_name_test.dart
index e0815b2..adc31e4 100644
--- a/test/get/git/require_pubspec_name_test.dart
+++ b/test/get/git/require_pubspec_name_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/git/require_pubspec_test.dart b/test/get/git/require_pubspec_test.dart
index fb1dd56..0f75c75 100644
--- a/test/get/git/require_pubspec_test.dart
+++ b/test/get/git/require_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/stay_locked_if_compatible_test.dart b/test/get/git/stay_locked_if_compatible_test.dart
index 615a11b..d7f6eb9 100644
--- a/test/get/git/stay_locked_if_compatible_test.dart
+++ b/test/get/git/stay_locked_if_compatible_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/git/unlock_if_incompatible_test.dart b/test/get/git/unlock_if_incompatible_test.dart
index 1a97136..61b60e6 100644
--- a/test/get/git/unlock_if_incompatible_test.dart
+++ b/test/get/git/unlock_if_incompatible_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/avoid_network_requests_test.dart b/test/get/hosted/avoid_network_requests_test.dart
index 4a0cd90..369a187 100644
--- a/test/get/hosted/avoid_network_requests_test.dart
+++ b/test/get/hosted/avoid_network_requests_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -27,7 +25,7 @@
// Clear the cache. We don't care about anything that was served during
// the initial get.
- globalServer.requestedPaths.clear();
+ globalServer!.requestedPaths.clear();
// Add "bar" to the dependencies.
await d.appDir({'foo': 'any', 'bar': 'any'}).create();
@@ -40,7 +38,7 @@
// The get should not have done any network requests since the lock file is
// up to date.
expect(
- globalServer.requestedPaths,
+ globalServer!.requestedPaths,
unorderedEquals([
// Bar should be requested because it's new, but not foo.
'api/packages/bar',
diff --git a/test/get/hosted/cached_pubspec_test.dart b/test/get/hosted/cached_pubspec_test.dart
index c4711c8..88551ac 100644
--- a/test/get/hosted/cached_pubspec_test.dart
+++ b/test/get/hosted/cached_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -20,7 +18,7 @@
// Clear the cache. We don't care about anything that was served during
// the initial get.
- globalServer.requestedPaths.clear();
+ globalServer!.requestedPaths.clear();
await d.cacheDir({'foo': '1.2.3'}).validate();
await d.appPackagesFile({'foo': '1.2.3'}).validate();
@@ -29,7 +27,7 @@
await pubGet();
// The get should not have requested the pubspec since it's local already.
- expect(globalServer.requestedPaths,
+ expect(globalServer!.requestedPaths,
isNot(contains('packages/foo/versions/1.2.3.yaml')));
});
}
diff --git a/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart b/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
index c635399..30e4a65 100644
--- a/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
+++ b/test/get/hosted/do_not_upgrade_on_removed_constraints_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/does_no_network_requests_when_possible_test.dart b/test/get/hosted/does_no_network_requests_when_possible_test.dart
index bca2c4d..3038624 100644
--- a/test/get/hosted/does_no_network_requests_when_possible_test.dart
+++ b/test/get/hosted/does_no_network_requests_when_possible_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -24,7 +22,7 @@
// Clear the cache. We don't care about anything that was served during
// the initial get.
- globalServer.requestedPaths.clear();
+ globalServer!.requestedPaths.clear();
// Run the solver again now that it's cached.
await pubGet();
@@ -34,6 +32,6 @@
// The get should not have done any network requests since the lock file is
// up to date.
- expect(globalServer.requestedPaths, isEmpty);
+ expect(globalServer!.requestedPaths, isEmpty);
});
}
diff --git a/test/get/hosted/explain_bad_hosted_url_test.dart b/test/get/hosted/explain_bad_hosted_url_test.dart
index 6de6860..5628ecb 100644
--- a/test/get/hosted/explain_bad_hosted_url_test.dart
+++ b/test/get/hosted/explain_bad_hosted_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -38,7 +36,7 @@
await d.appDir({'foo': 'any'}).create();
await pubGet(
- environment: {'PUB_HOSTED_URL': '${globalPackageServer.url}/'},
+ environment: {'PUB_HOSTED_URL': '${globalPackageServer!.url}/'},
);
});
}
diff --git a/test/get/hosted/get_stress_test.dart b/test/get/hosted/get_stress_test.dart
index 8a05104..da45309 100644
--- a/test/get/hosted/get_stress_test.dart
+++ b/test/get/hosted/get_stress_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/get_test.dart b/test/get/hosted/get_test.dart
index 13f9ad8..31c1f2e 100644
--- a/test/get/hosted/get_test.dart
+++ b/test/get/hosted/get_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/get/hosted/get_transitive_test.dart b/test/get/hosted/get_transitive_test.dart
index 4640c44..f68006a 100644
--- a/test/get/hosted/get_transitive_test.dart
+++ b/test/get/hosted/get_transitive_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart b/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
index 14f1d98..c53079c 100644
--- a/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
+++ b/test/get/hosted/gets_a_package_with_busted_dev_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/resolve_constraints_test.dart b/test/get/hosted/resolve_constraints_test.dart
index cf3d434..c515c8e 100644
--- a/test/get/hosted/resolve_constraints_test.dart
+++ b/test/get/hosted/resolve_constraints_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/hosted/resolve_with_retracted_package_versions_test.dart b/test/get/hosted/resolve_with_retracted_package_versions_test.dart
index af714cf..033e2a6 100644
--- a/test/get/hosted/resolve_with_retracted_package_versions_test.dart
+++ b/test/get/hosted/resolve_with_retracted_package_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
@@ -21,7 +19,7 @@
..serve('bar', '1.1.0'));
await d.appDir({'foo': '1.0.0'}).create();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.1.0'));
await pubGet();
@@ -35,7 +33,7 @@
..serve('bar', '1.0.0'));
await d.appDir({'foo': '1.0.0'}).create();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.0.0'));
await pubGet(
error:
@@ -59,18 +57,18 @@
await d.cacheDir({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.1.0'));
await pubUpgrade();
await d.cacheDir({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
- globalPackageServer.add((builder) => builder..serve('bar', '2.0.0'));
+ globalPackageServer!.add((builder) => builder..serve('bar', '2.0.0'));
await pubUpgrade();
await d.cacheDir({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.1.0'}).validate();
- globalPackageServer.add((builder) => builder..serve('bar', '1.2.0'));
+ globalPackageServer!.add((builder) => builder..serve('bar', '1.2.0'));
await pubUpgrade();
await d.cacheDir({'foo': '1.0.0', 'bar': '1.2.0'}).validate();
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.2.0'}).validate();
@@ -89,11 +87,11 @@
}).validate();
final barVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'bar-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'bar-versions.json');
expect(fileExists(barVersionsCache), isTrue);
deleteEntry(barVersionsCache);
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.1.0'));
await pubGet();
@@ -133,7 +131,7 @@
})
]).create();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('foo', '2.0.0'));
await pubGet();
@@ -151,9 +149,9 @@
await d.appDir({'foo': 'any'}).create();
await pubGet();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('foo', '2.0.0'));
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('foo', '3.0.0'));
await pubUpgrade();
diff --git a/test/get/hosted/stay_locked_if_compatible_test.dart b/test/get/hosted/stay_locked_if_compatible_test.dart
index 588f395..52129f2 100644
--- a/test/get/hosted/stay_locked_if_compatible_test.dart
+++ b/test/get/hosted/stay_locked_if_compatible_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -21,7 +19,7 @@
await d.appPackagesFile({'foo': '1.0.0'}).validate();
- globalPackageServer.add((builder) => builder.serve('foo', '1.0.1'));
+ globalPackageServer!.add((builder) => builder.serve('foo', '1.0.1'));
await d.appDir({'foo': '>=1.0.0'}).create();
diff --git a/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart b/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
index 743c5f4..73077b1 100644
--- a/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
+++ b/test/get/hosted/stay_locked_if_new_is_satisfied_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -26,7 +24,7 @@
await d.appPackagesFile(
{'foo': '1.0.0', 'bar': '1.0.0', 'baz': '1.0.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '2.0.0', deps: {'bar': '<3.0.0'});
builder.serve('bar', '2.0.0', deps: {'baz': '<3.0.0'});
builder.serve('baz', '2.0.0');
diff --git a/test/get/hosted/stay_locked_test.dart b/test/get/hosted/stay_locked_test.dart
index c5c11ff..eb26ea8 100644
--- a/test/get/hosted/stay_locked_test.dart
+++ b/test/get/hosted/stay_locked_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
@@ -28,7 +26,7 @@
deleteEntry(path.join(d.sandbox, packageConfigFilePath));
// Start serving a newer package as well.
- globalPackageServer.add((builder) => builder.serve('foo', '1.0.1'));
+ globalPackageServer!.add((builder) => builder.serve('foo', '1.0.1'));
// This shouldn't upgrade the foo dependency due to the lockfile.
await pubGet();
diff --git a/test/get/hosted/unlock_if_incompatible_test.dart b/test/get/hosted/unlock_if_incompatible_test.dart
index f9f8748..fad5400 100644
--- a/test/get/hosted/unlock_if_incompatible_test.dart
+++ b/test/get/hosted/unlock_if_incompatible_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -20,7 +18,7 @@
await pubGet();
await d.appPackagesFile({'foo': '1.0.0'}).validate();
- globalPackageServer.add((builder) => builder.serve('foo', '1.0.1'));
+ globalPackageServer!.add((builder) => builder.serve('foo', '1.0.1'));
await d.appDir({'foo': '>1.0.0'}).create();
await pubGet();
diff --git a/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart b/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
index feaf478..aa45b76 100644
--- a/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
+++ b/test/get/hosted/unlock_if_new_is_unsatisfied_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -31,7 +29,7 @@
'qux': '1.0.0'
}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '2.0.0', deps: {'bar': '<3.0.0'});
builder.serve('bar', '2.0.0', deps: {'baz': '<3.0.0'});
builder.serve('baz', '2.0.0', deps: {'qux': '<3.0.0'});
diff --git a/test/get/hosted/unlock_if_version_doesnt_exist_test.dart b/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
index f42e12e..328745e 100644
--- a/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
+++ b/test/get/hosted/unlock_if_version_doesnt_exist_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
@@ -22,7 +20,7 @@
deleteEntry(p.join(d.sandbox, cachePath));
- globalPackageServer.replace((builder) => builder.serve('foo', '1.0.1'));
+ globalPackageServer!.replace((builder) => builder.serve('foo', '1.0.1'));
await pubGet();
await d.appPackagesFile({'foo': '1.0.1'}).validate();
});
diff --git a/test/get/hosted/warn_about_discontinued_test.dart b/test/get/hosted/warn_about_discontinued_test.dart
index 76558a0..6df08b8 100644
--- a/test/get/hosted/warn_about_discontinued_test.dart
+++ b/test/get/hosted/warn_about_discontinued_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:path/path.dart' as p;
@@ -22,16 +20,16 @@
await d.appDir({'foo': '1.2.3'}).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
// A pub get straight away will not trigger the warning, as we cache
// responses for a while.
await pubGet();
final fooVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'foo-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'foo-versions.json');
final transitiveVersionsCache = p.join(
- globalPackageServer.cachingPath, '.cache', 'transitive-versions.json');
+ globalPackageServer!.cachingPath, '.cache', 'transitive-versions.json');
expect(fileExists(fooVersionsCache), isTrue);
expect(fileExists(transitiveVersionsCache), isTrue);
deleteEntry(fooVersionsCache);
@@ -48,7 +46,7 @@
c['_fetchedAt'] =
DateTime.now().subtract(Duration(days: 5)).toIso8601String();
writeTextFile(fooVersionsCache, json.encode(c));
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
await pubGet(output: '''
Resolving dependencies...
@@ -100,14 +98,14 @@
]).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
// A pub get straight away will not trigger the warning, as we cache
// responses for a while.
await pubGet();
final fooVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'foo-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'foo-versions.json');
expect(fileExists(fooVersionsCache), isTrue);
deleteEntry(fooVersionsCache);
// We warn only about the direct dependency here:
@@ -122,7 +120,7 @@
c['_fetchedAt'] =
DateTime.now().subtract(Duration(days: 5)).toIso8601String();
writeTextFile(fooVersionsCache, json.encode(c));
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
await pubGet(output: '''
Resolving dependencies...
@@ -160,11 +158,11 @@
await d.appDir({'foo': '1.2.3'}).create();
await pubGet();
final fooVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'foo-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'foo-versions.json');
expect(fileExists(fooVersionsCache), isTrue);
deleteEntry(fooVersionsCache);
// Serve 400 on all requests.
- globalPackageServer.extraHandlers
+ globalPackageServer!.extraHandlers
..clear()
..[RegExp('.*')] = (request) async => Response(400);
diff --git a/test/get/hosted/warn_about_retracted_package_test.dart b/test/get/hosted/warn_about_retracted_package_test.dart
index 5258d7c..5031061 100644
--- a/test/get/hosted/warn_about_retracted_package_test.dart
+++ b/test/get/hosted/warn_about_retracted_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
@@ -20,11 +18,11 @@
await pubGet();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.0.0'));
// Delete the cache to trigger the report.
final barVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'bar-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'bar-versions.json');
expect(fileExists(barVersionsCache), isTrue);
deleteEntry(barVersionsCache);
await pubGet(output: contains('bar 1.0.0 (retracted)'));
@@ -40,11 +38,11 @@
await pubGet();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.0.0'));
// Delete the cache to trigger the report.
final barVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'bar-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'bar-versions.json');
expect(fileExists(barVersionsCache), isTrue);
deleteEntry(barVersionsCache);
await pubGet(output: contains('bar 1.0.0 (retracted, 2.0.0 available)'));
@@ -60,11 +58,11 @@
await pubGet();
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder..retractPackageVersion('bar', '1.0.0-pre'));
// Delete the cache to trigger the report.
final barVersionsCache =
- p.join(globalPackageServer.cachingPath, '.cache', 'bar-versions.json');
+ p.join(globalPackageServer!.cachingPath, '.cache', 'bar-versions.json');
expect(fileExists(barVersionsCache), isTrue);
deleteEntry(barVersionsCache);
await pubGet(
diff --git a/test/get/package_name_test.dart b/test/get/package_name_test.dart
index f385cfe..46ca386 100644
--- a/test/get/package_name_test.dart
+++ b/test/get/package_name_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/path/absolute_path_test.dart b/test/get/path/absolute_path_test.dart
index 7304f52..0fc987a 100644
--- a/test/get/path/absolute_path_test.dart
+++ b/test/get/path/absolute_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/get/path/absolute_symlink_test.dart b/test/get/path/absolute_symlink_test.dart
index b0cd147..1a2d912 100644
--- a/test/get/path/absolute_symlink_test.dart
+++ b/test/get/path/absolute_symlink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/get/path/empty_pubspec_test.dart b/test/get/path/empty_pubspec_test.dart
index 5b94d70..0f9843f 100644
--- a/test/get/path/empty_pubspec_test.dart
+++ b/test/get/path/empty_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/path/no_pubspec_test.dart b/test/get/path/no_pubspec_test.dart
index d12477d..d328f25 100644
--- a/test/get/path/no_pubspec_test.dart
+++ b/test/get/path/no_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/path/nonexistent_dir_test.dart b/test/get/path/nonexistent_dir_test.dart
index 993590f..7616087 100644
--- a/test/get/path/nonexistent_dir_test.dart
+++ b/test/get/path/nonexistent_dir_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/path/path_is_file_test.dart b/test/get/path/path_is_file_test.dart
index 119a794..6fafd82 100644
--- a/test/get/path/path_is_file_test.dart
+++ b/test/get/path/path_is_file_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/get/path/relative_path_test.dart b/test/get/path/relative_path_test.dart
index a1d7437..4255d49 100644
--- a/test/get/path/relative_path_test.dart
+++ b/test/get/path/relative_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/lock_file.dart';
import 'package:pub/src/source_registry.dart';
@@ -93,7 +91,7 @@
var lockfilePath = path.join(d.sandbox, appPath, 'pubspec.lock');
var lockfile = LockFile.load(lockfilePath, SourceRegistry());
- var description = lockfile.packages['foo'].description;
+ var description = lockfile.packages['foo']!.description;
expect(description['relative'], isTrue);
expect(description['path'], path.join(d.sandbox, 'foo'));
diff --git a/test/get/path/relative_symlink_test.dart b/test/get/path/relative_symlink_test.dart
index e48ba41..af7185b 100644
--- a/test/get/path/relative_symlink_test.dart
+++ b/test/get/path/relative_symlink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
// Pub uses NTFS junction points to create links in the packages directory.
// These (unlike the symlinks that are supported in Vista and later) do not
// support relative paths. So this test, by design, will not pass on Windows.
diff --git a/test/get/path/shared_dependency_symlink_test.dart b/test/get/path/shared_dependency_symlink_test.dart
index 7d1369c..46a78c6 100644
--- a/test/get/path/shared_dependency_symlink_test.dart
+++ b/test/get/path/shared_dependency_symlink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/get/path/shared_dependency_test.dart b/test/get/path/shared_dependency_test.dart
index 3525e6b..7072221 100644
--- a/test/get/path/shared_dependency_test.dart
+++ b/test/get/path/shared_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/get/preserve_lock_file_line_endings_test.dart b/test/get/preserve_lock_file_line_endings_test.dart
index 8f6dc26..bfd015a 100644
--- a/test/get/preserve_lock_file_line_endings_test.dart
+++ b/test/get/preserve_lock_file_line_endings_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/entrypoint.dart';
import 'package:test/test.dart';
diff --git a/test/get/sdk_constraint_required_test.dart b/test/get/sdk_constraint_required_test.dart
index 3cb0f86..1b6fbc5 100644
--- a/test/get/sdk_constraint_required_test.dart
+++ b/test/get/sdk_constraint_required_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/get/switch_source_test.dart b/test/get/switch_source_test.dart
index 2dee748..dd8c97d 100644
--- a/test/get/switch_source_test.dart
+++ b/test/get/switch_source_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/get/with_empty_environment_test.dart b/test/get/with_empty_environment_test.dart
new file mode 100644
index 0000000..9a9f9e2
--- /dev/null
+++ b/test/get/with_empty_environment_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:test/test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+
+void main() {
+ test(r'runs even with an empty environment (eg. no $HOME)', () async {
+ await servePackages((builder) => builder.serve('foo', '1.2.3'));
+
+ await d.appDir({'foo': 'any'}).create();
+
+ await pubGet(environment: {
+ '_PUB_TEST_CONFIG_DIR': null,
+ if (Platform.isWindows) ...{
+ 'SYSTEMROOT': Platform.environment['SYSTEMROOT'],
+ 'TMP': Platform.environment['TMP'],
+ },
+ }, includeParentEnvironment: false);
+ });
+}
diff --git a/test/global/activate/activate_git_after_hosted_test.dart b/test/global/activate/activate_git_after_hosted_test.dart
index 5dd32c1..75925d3 100644
--- a/test/global/activate/activate_git_after_hosted_test.dart
+++ b/test/global/activate/activate_git_after_hosted_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/activate_hosted_after_git_test.dart b/test/global/activate/activate_hosted_after_git_test.dart
index a86b2cc..ba267b6 100644
--- a/test/global/activate/activate_hosted_after_git_test.dart
+++ b/test/global/activate/activate_hosted_after_git_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/activate_hosted_after_path_test.dart b/test/global/activate/activate_hosted_after_path_test.dart
index 1e01735..92985bd 100644
--- a/test/global/activate/activate_hosted_after_path_test.dart
+++ b/test/global/activate/activate_hosted_after_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/activate/activate_hosted_twice_test.dart b/test/global/activate/activate_hosted_twice_test.dart
index 50ed807..1923641 100644
--- a/test/global/activate/activate_hosted_twice_test.dart
+++ b/test/global/activate/activate_hosted_twice_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -48,7 +46,7 @@
await runPub(args: ['global', 'activate', 'foo']);
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.serve('bar', '2.0.0', contents: [
d.dir('lib', [d.file('bar.dart', 'final version = "2.0.0";')])
]));
diff --git a/test/global/activate/activate_path_after_hosted_test.dart b/test/global/activate/activate_path_after_hosted_test.dart
index c73cb01..f7cfa95 100644
--- a/test/global/activate/activate_path_after_hosted_test.dart
+++ b/test/global/activate/activate_path_after_hosted_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/activate/bad_version_test.dart b/test/global/activate/bad_version_test.dart
index 651c342..c5c4635 100644
--- a/test/global/activate/bad_version_test.dart
+++ b/test/global/activate/bad_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/cached_package_test.dart b/test/global/activate/cached_package_test.dart
index 7ddcf10..2daeaad 100644
--- a/test/global/activate/cached_package_test.dart
+++ b/test/global/activate/cached_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/constraint_test.dart b/test/global/activate/constraint_test.dart
index b712d00..0a18257 100644
--- a/test/global/activate/constraint_test.dart
+++ b/test/global/activate/constraint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/constraint_with_path_test.dart b/test/global/activate/constraint_with_path_test.dart
index 1a5beb7..359cd60 100644
--- a/test/global/activate/constraint_with_path_test.dart
+++ b/test/global/activate/constraint_with_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/custom_hosted_url_test.dart b/test/global/activate/custom_hosted_url_test.dart
index 7443887..54ee463 100644
--- a/test/global/activate/custom_hosted_url_test.dart
+++ b/test/global/activate/custom_hosted_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/global/activate/different_version_test.dart b/test/global/activate/different_version_test.dart
index 61ba228..dd6cca2 100644
--- a/test/global/activate/different_version_test.dart
+++ b/test/global/activate/different_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/doesnt_snapshot_path_executables_test.dart b/test/global/activate/doesnt_snapshot_path_executables_test.dart
index b809ea7..2ca8d3a 100644
--- a/test/global/activate/doesnt_snapshot_path_executables_test.dart
+++ b/test/global/activate/doesnt_snapshot_path_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/empty_constraint_test.dart b/test/global/activate/empty_constraint_test.dart
index 9e0bde9..fe0bd27 100644
--- a/test/global/activate/empty_constraint_test.dart
+++ b/test/global/activate/empty_constraint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/feature_test.dart b/test/global/activate/feature_test.dart
index 2d30460..6095aa1 100644
--- a/test/global/activate/feature_test.dart
+++ b/test/global/activate/feature_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
@Skip()
import 'package:test/test.dart';
diff --git a/test/global/activate/git_package_test.dart b/test/global/activate/git_package_test.dart
index 43cd218..ee88de7 100644
--- a/test/global/activate/git_package_test.dart
+++ b/test/global/activate/git_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/ignores_active_version_test.dart b/test/global/activate/ignores_active_version_test.dart
index d405f54..949456f 100644
--- a/test/global/activate/ignores_active_version_test.dart
+++ b/test/global/activate/ignores_active_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/installs_dependencies_for_git_test.dart b/test/global/activate/installs_dependencies_for_git_test.dart
index 8e5b477..e67fad4 100644
--- a/test/global/activate/installs_dependencies_for_git_test.dart
+++ b/test/global/activate/installs_dependencies_for_git_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/installs_dependencies_for_path_test.dart b/test/global/activate/installs_dependencies_for_path_test.dart
index 0afe76e..52f3e65 100644
--- a/test/global/activate/installs_dependencies_for_path_test.dart
+++ b/test/global/activate/installs_dependencies_for_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/installs_dependencies_test.dart b/test/global/activate/installs_dependencies_test.dart
index 0b26d8b..7114170 100644
--- a/test/global/activate/installs_dependencies_test.dart
+++ b/test/global/activate/installs_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/global/activate/missing_git_repo_test.dart b/test/global/activate/missing_git_repo_test.dart
index bbb2345..8db65c3 100644
--- a/test/global/activate/missing_git_repo_test.dart
+++ b/test/global/activate/missing_git_repo_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/missing_package_arg_test.dart b/test/global/activate/missing_package_arg_test.dart
index 0b747af..588ffcf 100644
--- a/test/global/activate/missing_package_arg_test.dart
+++ b/test/global/activate/missing_package_arg_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/outdated_binstub_test.dart b/test/global/activate/outdated_binstub_test.dart
index 43bed90..5a5a0e6 100644
--- a/test/global/activate/outdated_binstub_test.dart
+++ b/test/global/activate/outdated_binstub_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/path_package_test.dart b/test/global/activate/path_package_test.dart
index 5153760..6a08e9c 100644
--- a/test/global/activate/path_package_test.dart
+++ b/test/global/activate/path_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/activate/reactivating_git_upgrades_test.dart b/test/global/activate/reactivating_git_upgrades_test.dart
index 0ccbb65..100aaea 100644
--- a/test/global/activate/reactivating_git_upgrades_test.dart
+++ b/test/global/activate/reactivating_git_upgrades_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/removes_old_lockfile_test.dart b/test/global/activate/removes_old_lockfile_test.dart
index 7d7a9e0..a91a153 100644
--- a/test/global/activate/removes_old_lockfile_test.dart
+++ b/test/global/activate/removes_old_lockfile_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/snapshots_git_executables_test.dart b/test/global/activate/snapshots_git_executables_test.dart
index 81a0152..aee6a71 100644
--- a/test/global/activate/snapshots_git_executables_test.dart
+++ b/test/global/activate/snapshots_git_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/snapshots_hosted_executables_test.dart b/test/global/activate/snapshots_hosted_executables_test.dart
index e9d2a2d..c400ec7 100644
--- a/test/global/activate/snapshots_hosted_executables_test.dart
+++ b/test/global/activate/snapshots_hosted_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/supports_version_solver_backtracking_test.dart b/test/global/activate/supports_version_solver_backtracking_test.dart
index e43e735..7731bc6 100644
--- a/test/global/activate/supports_version_solver_backtracking_test.dart
+++ b/test/global/activate/supports_version_solver_backtracking_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/uncached_package_test.dart b/test/global/activate/uncached_package_test.dart
index 3bdb185..98b12af 100644
--- a/test/global/activate/uncached_package_test.dart
+++ b/test/global/activate/uncached_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/activate/unexpected_arguments_test.dart b/test/global/activate/unexpected_arguments_test.dart
index d7bb4cf..be6633d 100644
--- a/test/global/activate/unexpected_arguments_test.dart
+++ b/test/global/activate/unexpected_arguments_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/activate/unknown_package_test.dart b/test/global/activate/unknown_package_test.dart
index 6a4fe84..93a5d3a 100644
--- a/test/global/activate/unknown_package_test.dart
+++ b/test/global/activate/unknown_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/binstubs/binstub_runs_executable_test.dart b/test/global/binstubs/binstub_runs_executable_test.dart
index 284729b..c733f47 100644
--- a/test/global/binstubs/binstub_runs_executable_test.dart
+++ b/test/global/binstubs/binstub_runs_executable_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
import 'package:test_process/test_process.dart';
diff --git a/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart b/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart
index 25a6281..8024c3a 100644
--- a/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart
+++ b/test/global/binstubs/binstub_runs_global_run_if_no_snapshot_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart b/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart
index f59d8e2..f66a251 100644
--- a/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart
+++ b/test/global/binstubs/binstub_runs_precompiled_snapshot_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/creates_executables_in_pubspec_test.dart b/test/global/binstubs/creates_executables_in_pubspec_test.dart
index 1529d3e..8fe53dc 100644
--- a/test/global/binstubs/creates_executables_in_pubspec_test.dart
+++ b/test/global/binstubs/creates_executables_in_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/does_not_warn_if_no_executables_test.dart b/test/global/binstubs/does_not_warn_if_no_executables_test.dart
index e172b1b..b7ca722 100644
--- a/test/global/binstubs/does_not_warn_if_no_executables_test.dart
+++ b/test/global/binstubs/does_not_warn_if_no_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/does_not_warn_if_on_path_test.dart b/test/global/binstubs/does_not_warn_if_on_path_test.dart
index 07cba16..fd0dfa7 100644
--- a/test/global/binstubs/does_not_warn_if_on_path_test.dart
+++ b/test/global/binstubs/does_not_warn_if_on_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
diff --git a/test/global/binstubs/explicit_and_no_executables_options_test.dart b/test/global/binstubs/explicit_and_no_executables_options_test.dart
index d493bd7..68bbd5b 100644
--- a/test/global/binstubs/explicit_and_no_executables_options_test.dart
+++ b/test/global/binstubs/explicit_and_no_executables_options_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/binstubs/explicit_executables_test.dart b/test/global/binstubs/explicit_executables_test.dart
index e032c32..e721f73 100644
--- a/test/global/binstubs/explicit_executables_test.dart
+++ b/test/global/binstubs/explicit_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/missing_script_test.dart b/test/global/binstubs/missing_script_test.dart
index 96b5e89..433f9cf 100644
--- a/test/global/binstubs/missing_script_test.dart
+++ b/test/global/binstubs/missing_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
diff --git a/test/global/binstubs/name_collision_test.dart b/test/global/binstubs/name_collision_test.dart
index 54afc02..75b72ce 100644
--- a/test/global/binstubs/name_collision_test.dart
+++ b/test/global/binstubs/name_collision_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/name_collision_with_overwrite_test.dart b/test/global/binstubs/name_collision_with_overwrite_test.dart
index caed6d1..6e5a869 100644
--- a/test/global/binstubs/name_collision_with_overwrite_test.dart
+++ b/test/global/binstubs/name_collision_with_overwrite_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/no_executables_flag_test.dart b/test/global/binstubs/no_executables_flag_test.dart
index d7bc037..39f91cd 100644
--- a/test/global/binstubs/no_executables_flag_test.dart
+++ b/test/global/binstubs/no_executables_flag_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart b/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart
index f4cd075..e86757c 100644
--- a/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart
+++ b/test/global/binstubs/outdated_binstub_runs_pub_global_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -15,7 +13,7 @@
import 'utils.dart';
/// The contents of the binstub for [executable], or `null` if it doesn't exist.
-String binStub(String executable) {
+String? binStub(String executable) {
final f = File(p.join(d.sandbox, cachePath, 'bin', binStubName(executable)));
if (f.existsSync()) {
return f.readAsStringSync();
diff --git a/test/global/binstubs/outdated_snapshot_test.dart b/test/global/binstubs/outdated_snapshot_test.dart
index c1181b9..e749a5c 100644
--- a/test/global/binstubs/outdated_snapshot_test.dart
+++ b/test/global/binstubs/outdated_snapshot_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/binstubs/path_package_test.dart b/test/global/binstubs/path_package_test.dart
index d702054..0461e35 100644
--- a/test/global/binstubs/path_package_test.dart
+++ b/test/global/binstubs/path_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/reactivate_removes_old_executables_test.dart b/test/global/binstubs/reactivate_removes_old_executables_test.dart
index e7f6ade..80b50ff 100644
--- a/test/global/binstubs/reactivate_removes_old_executables_test.dart
+++ b/test/global/binstubs/reactivate_removes_old_executables_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart b/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart
index ed215ae..4cd458e 100644
--- a/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart
+++ b/test/global/binstubs/removes_even_if_not_in_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/removes_when_deactivated_test.dart b/test/global/binstubs/removes_when_deactivated_test.dart
index d241f27..05c8413 100644
--- a/test/global/binstubs/removes_when_deactivated_test.dart
+++ b/test/global/binstubs/removes_when_deactivated_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/binstubs/runs_once_even_when_dart_is_batch_test.dart b/test/global/binstubs/runs_once_even_when_dart_is_batch_test.dart
index d53af96..54f3932 100644
--- a/test/global/binstubs/runs_once_even_when_dart_is_batch_test.dart
+++ b/test/global/binstubs/runs_once_even_when_dart_is_batch_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
diff --git a/test/global/binstubs/unknown_explicit_executable_test.dart b/test/global/binstubs/unknown_explicit_executable_test.dart
index 0b27527..33b82e7 100644
--- a/test/global/binstubs/unknown_explicit_executable_test.dart
+++ b/test/global/binstubs/unknown_explicit_executable_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/binstubs/utils.dart b/test/global/binstubs/utils.dart
index e2346cc..59a8df0 100644
--- a/test/global/binstubs/utils.dart
+++ b/test/global/binstubs/utils.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -16,7 +14,7 @@
///
/// The `pub`/`pub.bat` command on the PATH will be the one in tool/test-bin not
/// the one from the sdk.
-Map getEnvironment() {
+Map<String, String> getEnvironment() {
var binDir = p.dirname(Platform.resolvedExecutable);
var separator = Platform.isWindows ? ';' : ':';
var pubBin = p.absolute('tool', 'test-bin');
diff --git a/test/global/binstubs/warns_if_not_on_path_test.dart b/test/global/binstubs/warns_if_not_on_path_test.dart
index fcfdb0c..d09e698 100644
--- a/test/global/binstubs/warns_if_not_on_path_test.dart
+++ b/test/global/binstubs/warns_if_not_on_path_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/deactivate/deactivate_and_reactivate_package_test.dart b/test/global/deactivate/deactivate_and_reactivate_package_test.dart
index ffad990..cc7f597 100644
--- a/test/global/deactivate/deactivate_and_reactivate_package_test.dart
+++ b/test/global/deactivate/deactivate_and_reactivate_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/global/deactivate/git_package_test.dart b/test/global/deactivate/git_package_test.dart
index 3aa047d..f06ce53 100644
--- a/test/global/deactivate/git_package_test.dart
+++ b/test/global/deactivate/git_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/deactivate/hosted_package_test.dart b/test/global/deactivate/hosted_package_test.dart
index 884e70f..854d6a9 100644
--- a/test/global/deactivate/hosted_package_test.dart
+++ b/test/global/deactivate/hosted_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../test_pub.dart';
diff --git a/test/global/deactivate/missing_package_arg_test.dart b/test/global/deactivate/missing_package_arg_test.dart
index 6671991..8de8ab1 100644
--- a/test/global/deactivate/missing_package_arg_test.dart
+++ b/test/global/deactivate/missing_package_arg_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/deactivate/path_package_test.dart b/test/global/deactivate/path_package_test.dart
index f28d8d1..1f50713 100644
--- a/test/global/deactivate/path_package_test.dart
+++ b/test/global/deactivate/path_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/deactivate/removes_precompiled_snapshots_test.dart b/test/global/deactivate/removes_precompiled_snapshots_test.dart
index 7d075b3..7ea6d58 100644
--- a/test/global/deactivate/removes_precompiled_snapshots_test.dart
+++ b/test/global/deactivate/removes_precompiled_snapshots_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/deactivate/unexpected_arguments_test.dart b/test/global/deactivate/unexpected_arguments_test.dart
index 426b7f8..dd1f11f 100644
--- a/test/global/deactivate/unexpected_arguments_test.dart
+++ b/test/global/deactivate/unexpected_arguments_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/deactivate/unknown_package_test.dart b/test/global/deactivate/unknown_package_test.dart
index ad0973e..d67460d 100644
--- a/test/global/deactivate/unknown_package_test.dart
+++ b/test/global/deactivate/unknown_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/list_test.dart b/test/global/list_test.dart
index 8b7293a..4b50184 100644
--- a/test/global/list_test.dart
+++ b/test/global/list_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
diff --git a/test/global/run/errors_if_outside_bin_test.dart b/test/global/run/errors_if_outside_bin_test.dart
index e6c15f7..098f0bb 100644
--- a/test/global/run/errors_if_outside_bin_test.dart
+++ b/test/global/run/errors_if_outside_bin_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart b/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart
index 73b5556..08adbcc 100644
--- a/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart
+++ b/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/run/implicit_executable_name_test.dart b/test/global/run/implicit_executable_name_test.dart
index a2f8c12..fa7bf51 100644
--- a/test/global/run/implicit_executable_name_test.dart
+++ b/test/global/run/implicit_executable_name_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/missing_executable_arg_test.dart b/test/global/run/missing_executable_arg_test.dart
index efab258..b64d387 100644
--- a/test/global/run/missing_executable_arg_test.dart
+++ b/test/global/run/missing_executable_arg_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/run/missing_path_package_test.dart b/test/global/run/missing_path_package_test.dart
index f15d976..99cf30a 100644
--- a/test/global/run/missing_path_package_test.dart
+++ b/test/global/run/missing_path_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/global/run/nonexistent_script_test.dart b/test/global/run/nonexistent_script_test.dart
index dc0a738..d4f9577 100644
--- a/test/global/run/nonexistent_script_test.dart
+++ b/test/global/run/nonexistent_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/run/package_api_test.dart b/test/global/run/package_api_test.dart
index c95fc5b..4ce34ee 100644
--- a/test/global/run/package_api_test.dart
+++ b/test/global/run/package_api_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
@@ -46,11 +44,11 @@
expect(pub.stdout, emits(p.toUri(packageConfigPath).toString()));
var fooResourcePath = p.join(
- globalPackageServer.pathInCache('foo', '1.0.0'), 'lib/resource.txt');
+ globalPackageServer!.pathInCache('foo', '1.0.0'), 'lib/resource.txt');
expect(pub.stdout, emits(p.toUri(fooResourcePath).toString()));
var barResourcePath = p.join(
- globalPackageServer.pathInCache('bar', '1.0.0'), 'lib/resource.txt');
+ globalPackageServer!.pathInCache('bar', '1.0.0'), 'lib/resource.txt');
expect(pub.stdout, emits(p.toUri(barResourcePath).toString()));
await pub.shouldExit(0);
});
diff --git a/test/global/run/recompiles_if_snapshot_is_out_of_date_test.dart b/test/global/run/recompiles_if_snapshot_is_out_of_date_test.dart
index 4ace362..97c69f2 100644
--- a/test/global/run/recompiles_if_snapshot_is_out_of_date_test.dart
+++ b/test/global/run/recompiles_if_snapshot_is_out_of_date_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/run/reflects_changes_to_local_package_test.dart b/test/global/run/reflects_changes_to_local_package_test.dart
index 5bc9e55..864111b 100644
--- a/test/global/run/reflects_changes_to_local_package_test.dart
+++ b/test/global/run/reflects_changes_to_local_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_git_script_test.dart b/test/global/run/runs_git_script_test.dart
index 8d120b4..900b586 100644
--- a/test/global/run/runs_git_script_test.dart
+++ b/test/global/run/runs_git_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_path_script_test.dart b/test/global/run/runs_path_script_test.dart
index 90db648..7cc90d4 100644
--- a/test/global/run/runs_path_script_test.dart
+++ b/test/global/run/runs_path_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_script_in_checked_mode_test.dart b/test/global/run/runs_script_in_checked_mode_test.dart
index 1b399c5..69cd393 100644
--- a/test/global/run/runs_script_in_checked_mode_test.dart
+++ b/test/global/run/runs_script_in_checked_mode_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_script_in_unchecked_mode_test.dart b/test/global/run/runs_script_in_unchecked_mode_test.dart
index 005bad3..d684c27 100644
--- a/test/global/run/runs_script_in_unchecked_mode_test.dart
+++ b/test/global/run/runs_script_in_unchecked_mode_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_script_test.dart b/test/global/run/runs_script_test.dart
index bab4d1c..fe767ef 100644
--- a/test/global/run/runs_script_test.dart
+++ b/test/global/run/runs_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/global/run/runs_script_without_packages_file_test.dart b/test/global/run/runs_script_without_packages_file_test.dart
index aa5e691..cb63be2 100644
--- a/test/global/run/runs_script_without_packages_file_test.dart
+++ b/test/global/run/runs_script_without_packages_file_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/global/run/unknown_package_test.dart b/test/global/run/unknown_package_test.dart
index 55a875a..a5fba21 100644
--- a/test/global/run/unknown_package_test.dart
+++ b/test/global/run/unknown_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/global/run/uses_old_lockfile_test.dart b/test/global/run/uses_old_lockfile_test.dart
index 4ae12ef..5eb8406 100644
--- a/test/global/run/uses_old_lockfile_test.dart
+++ b/test/global/run/uses_old_lockfile_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/golden_file.dart b/test/golden_file.dart
index 90d2340..7927776 100644
--- a/test/golden_file.dart
+++ b/test/golden_file.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:io';
@@ -40,14 +38,14 @@
' END OF OUTPUT '
'---------------------------------\n\n';
- final String _currentTestFile;
- final String _testName;
+ late final String _currentTestFile;
+ late final String _testName;
- String _goldenFilePath;
- File _goldenFile;
- String _header;
+ late String _goldenFilePath;
+ late File _goldenFile;
+ late String _header;
final _results = <String>[];
- bool _goldenFileExists;
+ late bool _goldenFileExists;
bool _generatedNewData = false; // track if new data is generated
int _nextSectionIndex = 0;
@@ -151,8 +149,8 @@
/// log stdout/stderr and exitcode to golden file.
Future<void> run(
List<String> args, {
- Map<String, String> environment,
- String workingDirectory,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async {
// Create new section index number (before doing anything async)
final sectionIndex = _nextSectionIndex++;
@@ -169,7 +167,7 @@
}
/// Log directory tree structure under [directory] to golden file.
- Future<void> tree([String directory]) async {
+ Future<void> tree([String? directory]) async {
// Create new section index number (before doing anything async)
final sectionIndex = _nextSectionIndex++;
diff --git a/test/help_test.dart b/test/help_test.dart
index 7ef96ff..e66f8a4 100644
--- a/test/help_test.dart
+++ b/test/help_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
import 'package:args/command_runner.dart';
import 'package:pub/src/command_runner.dart' show PubCommandRunner;
diff --git a/test/hosted/fail_gracefully_on_bad_version_listing_response_test.dart b/test/hosted/fail_gracefully_on_bad_version_listing_response_test.dart
index f5ad35c..be875a2 100644
--- a/test/hosted/fail_gracefully_on_bad_version_listing_response_test.dart
+++ b/test/hosted/fail_gracefully_on_bad_version_listing_response_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -19,7 +17,7 @@
'fails gracefully if the package server responds with broken package listings',
() async {
await servePackages((b) => b..serve('foo', '1.2.3'));
- globalPackageServer.extraHandlers[RegExp('/api/packages/.*')] =
+ globalPackageServer!.extraHandlers[RegExp('/api/packages/.*')] =
expectAsync1((request) {
expect(request.method, 'GET');
return Response(200,
diff --git a/test/hosted/fail_gracefully_on_invalid_url_test.dart b/test/hosted/fail_gracefully_on_invalid_url_test.dart
index 9cbfbe8..94922c0 100644
--- a/test/hosted/fail_gracefully_on_invalid_url_test.dart
+++ b/test/hosted/fail_gracefully_on_invalid_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/hosted/fail_gracefully_on_missing_package_test.dart b/test/hosted/fail_gracefully_on_missing_package_test.dart
index 882d11c..1840f18 100644
--- a/test/hosted/fail_gracefully_on_missing_package_test.dart
+++ b/test/hosted/fail_gracefully_on_missing_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/hosted/fail_gracefully_on_url_resolve_test.dart b/test/hosted/fail_gracefully_on_url_resolve_test.dart
index 9e3abcd..7a91e7a 100644
--- a/test/hosted/fail_gracefully_on_url_resolve_test.dart
+++ b/test/hosted/fail_gracefully_on_url_resolve_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/hosted/metadata_test.dart b/test/hosted/metadata_test.dart
index 6ba59f5..7554a0f 100644
--- a/test/hosted/metadata_test.dart
+++ b/test/hosted/metadata_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:test/test.dart';
diff --git a/test/hosted/offline_test.dart b/test/hosted/offline_test.dart
index ef738c8..713ea3f 100644
--- a/test/hosted/offline_test.dart
+++ b/test/hosted/offline_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -39,7 +37,7 @@
await d.appDir({'foo': 'any', 'bar': 'any'}).create();
- String warning;
+ String? warning;
if (command == RunCommand.upgrade) {
warning = 'Warning: Upgrading when offline may not update you '
'to the latest versions of your dependencies.';
@@ -59,7 +57,7 @@
await d.appDir({'foo': 'any'}).create();
- String warning;
+ String? warning;
if (command == RunCommand.upgrade) {
warning = 'Warning: Upgrading when offline may not update you '
'to the latest versions of your dependencies.';
diff --git a/test/hosted/remove_removed_dependency_test.dart b/test/hosted/remove_removed_dependency_test.dart
index 9d530d7..d326384 100644
--- a/test/hosted/remove_removed_dependency_test.dart
+++ b/test/hosted/remove_removed_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/hosted/remove_removed_transitive_dependency_test.dart b/test/hosted/remove_removed_transitive_dependency_test.dart
index 43ac01c..50702d7 100644
--- a/test/hosted/remove_removed_transitive_dependency_test.dart
+++ b/test/hosted/remove_removed_transitive_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/hosted/short_syntax_test.dart b/test/hosted/short_syntax_test.dart
index bfbb3b4..70738a9 100644
--- a/test/hosted/short_syntax_test.dart
+++ b/test/hosted/short_syntax_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -44,19 +42,19 @@
'source': 'hosted',
'description': {
'name': 'foo',
- 'url': globalPackageServer.url,
+ 'url': globalPackageServer!.url,
},
'version': '1.2.3',
});
}
test('supports hosted: <url> syntax', () async {
- return testWith({'hosted': globalPackageServer.url});
+ return testWith({'hosted': globalPackageServer!.url});
});
test('supports hosted map without name', () {
return testWith({
- 'hosted': {'url': globalPackageServer.url},
+ 'hosted': {'url': globalPackageServer!.url},
});
});
@@ -83,7 +81,7 @@
);
expect(lockFile['packages']['foo']['description']['url'],
- globalPackageServer.url);
+ globalPackageServer!.url);
});
});
}
diff --git a/test/hosted/version_negotiation_test.dart b/test/hosted/version_negotiation_test.dart
index 3d12703..ff491cd 100644
--- a/test/hosted/version_negotiation_test.dart
+++ b/test/hosted/version_negotiation_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -18,11 +16,11 @@
await d.appDir({
'foo': {
- 'hosted': {'name': 'foo', 'url': globalPackageServer.url}
+ 'hosted': {'name': 'foo', 'url': globalPackageServer!.url}
}
}).create();
- globalPackageServer.expect('GET', '/api/packages/foo', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/foo', (request) {
expect(
request.headers['accept'], equals('application/vnd.pub.v2+json'));
return shelf.Response(404);
@@ -37,14 +35,14 @@
await d.appDir({
'foo': {
- 'hosted': {'name': 'foo', 'url': globalPackageServer.url}
+ 'hosted': {'name': 'foo', 'url': globalPackageServer!.url}
}
}).create();
var pub = await startPub(args: [command.name]);
- globalPackageServer.expect(
- 'GET', '/api/packages/foo', (request) => shelf.Response(406));
+ globalPackageServer!
+ .expect('GET', '/api/packages/foo', (request) => shelf.Response(406));
await pub.shouldExit(1);
diff --git a/test/hosted/will_normalize_hosted_url_test.dart b/test/hosted/will_normalize_hosted_url_test.dart
index f2da266..38bc574 100644
--- a/test/hosted/will_normalize_hosted_url_test.dart
+++ b/test/hosted/will_normalize_hosted_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:http/http.dart' as http;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:shelf/shelf.dart';
@@ -20,19 +18,19 @@
// will be on the form:
// http://localhost:<port>
// In particular, that it doesn't contain anything path segment.
- expect(Uri.parse(globalPackageServer.url).path, isEmpty);
+ expect(Uri.parse(globalPackageServer!.url).path, isEmpty);
await d.dir(appPath, [
d.appPubspec({
'foo': {
- 'hosted': {'name': 'foo', 'url': globalPackageServer.url},
+ 'hosted': {'name': 'foo', 'url': globalPackageServer!.url},
},
}),
]).create();
await pubCommand(
command,
- silent: contains('${globalPackageServer.url}/api/packages/foo'),
+ silent: contains('${globalPackageServer!.url}/api/packages/foo'),
);
});
@@ -42,20 +40,20 @@
await d.dir(appPath, [
d.appPubspec({
'foo': {
- 'hosted': {'name': 'foo', 'url': globalPackageServer.url + '/'},
+ 'hosted': {'name': 'foo', 'url': globalPackageServer!.url + '/'},
},
}),
]).create();
await pubCommand(
command,
- silent: contains('${globalPackageServer.url}/api/packages/foo'),
+ silent: contains('${globalPackageServer!.url}/api/packages/foo'),
);
});
test('cannot normalize double slash', () async {
await servePackages((b) => b..serve('foo', '1.2.3'));
- globalPackageServer.expect(
+ globalPackageServer!.expect(
'GET',
'//api/packages/foo',
(request) => Response.notFound(''),
@@ -64,7 +62,7 @@
await d.dir(appPath, [
d.appPubspec({
'foo': {
- 'hosted': {'name': 'foo', 'url': globalPackageServer.url + '//'},
+ 'hosted': {'name': 'foo', 'url': globalPackageServer!.url + '//'},
},
}),
]).create();
@@ -72,7 +70,7 @@
await pubCommand(
command,
error: contains(
- 'could not find package foo at ${globalPackageServer.url}//'),
+ 'could not find package foo at ${globalPackageServer!.url}//'),
exitCode: exit_codes.UNAVAILABLE,
);
});
@@ -82,16 +80,16 @@
/// This is a bit of a hack, to easily test if hosted pub URLs with a path
/// segment works and if the slashes are normalized.
void _proxyMyFolderToRoot() {
- globalPackageServer.extraHandlers[RegExp('/my-folder/.*')] = (r) async {
+ globalPackageServer!.extraHandlers[RegExp('/my-folder/.*')] = (r) async {
if (r.method != 'GET' && r.method != 'HEAD') {
return Response.forbidden(null);
}
final path = r.requestedUri.path.substring('/my-folder/'.length);
final res = await http.get(
- Uri.parse(globalPackageServer.url + '/$path'),
+ Uri.parse(globalPackageServer!.url + '/$path'),
);
return Response(res.statusCode, body: res.bodyBytes, headers: {
- 'Content-Type': res.headers['Content-Type'],
+ 'content-type': res.headers['content-type']!,
});
};
}
@@ -101,8 +99,8 @@
_proxyMyFolderToRoot();
// testing with a normalized URL
- final testUrl = globalPackageServer.url + '/my-folder/';
- final normalizedUrl = globalPackageServer.url + '/my-folder/';
+ final testUrl = globalPackageServer!.url + '/my-folder/';
+ final normalizedUrl = globalPackageServer!.url + '/my-folder/';
await d.dir(appPath, [
d.appPubspec({
@@ -124,8 +122,8 @@
_proxyMyFolderToRoot();
// Testing with a URL that is missing the slash.
- final testUrl = globalPackageServer.url + '/my-folder';
- final normalizedUrl = globalPackageServer.url + '/my-folder/';
+ final testUrl = globalPackageServer!.url + '/my-folder';
+ final normalizedUrl = globalPackageServer!.url + '/my-folder/';
await d.dir(appPath, [
d.appPubspec({
diff --git a/test/ignore_test.dart b/test/ignore_test.dart
index 75238b5..42a189a 100644
--- a/test/ignore_test.dart
+++ b/test/ignore_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:pub/src/ignore.dart';
@@ -41,10 +39,10 @@
return [path.substring(0, nextSlash == -1 ? path.length : nextSlash)];
}
- Ignore ignoreForDir(String dir) => c.patterns[dir] == null
+ Ignore? ignoreForDir(String dir) => c.patterns[dir] == null
? null
: Ignore(
- c.patterns[dir],
+ c.patterns[dir]!,
onInvalidPattern: (_, __) => hasWarning = true,
ignoreCase: ignoreCase,
);
@@ -87,17 +85,18 @@
for (final c in testData) {
c.paths.forEach((path, expected) {
- if (c.ignoreCase == null) {
+ var ignoreCase = c.ignoreCase;
+ if (ignoreCase == null) {
_testIgnorePath(c, path, expected, false);
_testIgnorePath(c, path, expected, true);
} else {
- _testIgnorePath(c, path, expected, c.ignoreCase);
+ _testIgnorePath(c, path, expected, ignoreCase);
}
});
}
});
- ProcessResult runGit(List<String> args, {String workingDirectory}) {
+ ProcessResult runGit(List<String> args, {String? workingDirectory}) {
final executable = Platform.isWindows ? 'cmd' : 'git';
args = Platform.isWindows ? ['/c', 'git', ...args] : args;
return Process.runSync(executable, args,
@@ -105,24 +104,24 @@
}
group('git', () {
- Directory tmp;
+ Directory? tmp;
setUpAll(() async {
tmp = await Directory.systemTemp.createTemp('package-ignore-test-');
- final ret = runGit(['init'], workingDirectory: tmp.path);
+ final ret = runGit(['init'], workingDirectory: tmp!.path);
expect(ret.exitCode, equals(0),
reason:
'Running "git init" failed. StdErr: ${ret.stderr} StdOut: ${ret.stdout}');
});
tearDownAll(() async {
- await tmp.delete(recursive: true);
+ await tmp!.delete(recursive: true);
tmp = null;
});
tearDown(() async {
- runGit(['clean', '-f', '-d', '-x'], workingDirectory: tmp.path);
+ runGit(['clean', '-f', '-d', '-x'], workingDirectory: tmp!.path);
});
void _testIgnorePath(
@@ -137,7 +136,7 @@
expect(
runGit(
['config', '--local', 'core.ignoreCase', ignoreCase.toString()],
- workingDirectory: tmp.path,
+ workingDirectory: tmp!.path,
).exitCode,
anyOf(0, 1),
reason: 'Running "git config --local core.ignoreCase ..." failed',
@@ -145,17 +144,17 @@
for (final directory in c.patterns.keys) {
final resolvedDirectory =
- directory == '' ? tmp.uri : tmp.uri.resolve(directory + '/');
+ directory == '' ? tmp!.uri : tmp!.uri.resolve(directory + '/');
Directory.fromUri(resolvedDirectory).createSync(recursive: true);
final gitIgnore =
File.fromUri(resolvedDirectory.resolve('.gitignore'));
gitIgnore.writeAsStringSync(
- c.patterns[directory].join('\n') + '\n',
+ c.patterns[directory]!.join('\n') + '\n',
);
}
final process = runGit(
- ['-C', tmp.path, 'check-ignore', '--no-index', path],
- workingDirectory: tmp.path);
+ ['-C', tmp!.path, 'check-ignore', '--no-index', path],
+ workingDirectory: tmp!.path);
expect(process.exitCode, anyOf(0, 1),
reason: 'Running "git check-ignore" failed');
final ignored = process.exitCode == 0;
@@ -172,11 +171,12 @@
for (final c in testData) {
c.paths.forEach((path, expected) {
- if (c.ignoreCase == null) {
+ var ignoreCase = c.ignoreCase;
+ if (ignoreCase == null) {
_testIgnorePath(c, path, expected, false);
_testIgnorePath(c, path, expected, true);
} else {
- _testIgnorePath(c, path, expected, c.ignoreCase);
+ _testIgnorePath(c, path, expected, ignoreCase);
}
});
}
@@ -200,7 +200,7 @@
final bool skipOnWindows;
/// Test with `core.ignoreCase` set to `true`, `false` or both (if `null`).
- final bool ignoreCase;
+ final bool? ignoreCase;
TestData(
this.name,
diff --git a/test/io_test.dart b/test/io_test.dart
index b54bc91..2c529cd 100644
--- a/test/io_test.dart
+++ b/test/io_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -463,14 +461,14 @@
}
void testExistencePredicate(String name, bool Function(String path) predicate,
- {bool forFile,
- bool forFileSymlink,
- bool forMultiLevelFileSymlink,
- bool forDirectory,
- bool forDirectorySymlink,
- bool forMultiLevelDirectorySymlink,
- bool forBrokenSymlink,
- bool forMultiLevelBrokenSymlink}) {
+ {required bool forFile,
+ required bool forFileSymlink,
+ required bool forMultiLevelFileSymlink,
+ required bool forDirectory,
+ required bool forDirectorySymlink,
+ required bool forMultiLevelDirectorySymlink,
+ required bool forBrokenSymlink,
+ required bool forMultiLevelBrokenSymlink}) {
group(name, () {
test('returns $forFile for a file', () {
expect(withTempDir((temp) {
diff --git a/test/levenshtein_test.dart b/test/levenshtein_test.dart
index 6d113c7..67361af 100644
--- a/test/levenshtein_test.dart
+++ b/test/levenshtein_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/levenshtein.dart';
import 'package:test/test.dart';
diff --git a/test/lish/archives_and_uploads_a_package_test.dart b/test/lish/archives_and_uploads_a_package_test.dart
index 2efeb4a..0fffb5a 100644
--- a/test/lish/archives_and_uploads_a_package_test.dart
+++ b/test/lish/archives_and_uploads_a_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:path/path.dart' as p;
@@ -21,14 +19,14 @@
test('archives and uploads a package', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
@@ -55,14 +53,14 @@
await d.dir(p.join(appPath, 'empty')).create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/cloud_storage_upload_doesnt_redirect_test.dart b/test/lish/cloud_storage_upload_doesnt_redirect_test.dart
index f2e542f..e4489e4 100644
--- a/test/lish/cloud_storage_upload_doesnt_redirect_test.dart
+++ b/test/lish/cloud_storage_upload_doesnt_redirect_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -16,13 +14,13 @@
test("cloud storage upload doesn't redirect", () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
- globalPackageServer.expect('POST', '/upload', (request) async {
+ globalPackageServer!.expect('POST', '/upload', (request) async {
await request.read().drain();
return shelf.Response(200);
});
diff --git a/test/lish/cloud_storage_upload_provides_an_error_test.dart b/test/lish/cloud_storage_upload_provides_an_error_test.dart
index a67d85b..ebb463a 100644
--- a/test/lish/cloud_storage_upload_provides_an_error_test.dart
+++ b/test/lish/cloud_storage_upload_provides_an_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -16,13 +14,13 @@
test('cloud storage upload provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
- globalPackageServer.expect('POST', '/upload', (request) {
+ globalPackageServer!.expect('POST', '/upload', (request) {
return request.read().drain().then((_) {
return shelf.Response.notFound(
'<Error><Message>Your request sucked.</Message></Error>',
diff --git a/test/lish/does_not_include_dot_file.dart b/test/lish/does_not_include_dot_file.dart
index 6dfa622..9f1b24f 100644
--- a/test/lish/does_not_include_dot_file.dart
+++ b/test/lish/does_not_include_dot_file.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -32,14 +30,14 @@
test('Check if package doesn\'t include dot-files', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/does_not_publish_if_private_test.dart b/test/lish/does_not_publish_if_private_test.dart
index 9ab8712..52321c2 100644
--- a/test/lish/does_not_publish_if_private_test.dart
+++ b/test/lish/does_not_publish_if_private_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/does_not_publish_if_private_with_server_arg_test.dart b/test/lish/does_not_publish_if_private_with_server_arg_test.dart
index c33b1a3..689609b 100644
--- a/test/lish/does_not_publish_if_private_with_server_arg_test.dart
+++ b/test/lish/does_not_publish_if_private_with_server_arg_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/dry_run_warns_about_server_checks.dart b/test/lish/dry_run_warns_about_server_checks.dart
index 8e12f9b..ad7abe0 100644
--- a/test/lish/dry_run_warns_about_server_checks.dart
+++ b/test/lish/dry_run_warns_about_server_checks.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/lish/force_cannot_be_combined_with_dry_run_test.dart b/test/lish/force_cannot_be_combined_with_dry_run_test.dart
index 6e77aa3..9d2233c 100644
--- a/test/lish/force_cannot_be_combined_with_dry_run_test.dart
+++ b/test/lish/force_cannot_be_combined_with_dry_run_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/force_does_not_publish_if_private_test.dart b/test/lish/force_does_not_publish_if_private_test.dart
index 9ca4bf6..0d4ad59 100644
--- a/test/lish/force_does_not_publish_if_private_test.dart
+++ b/test/lish/force_does_not_publish_if_private_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/force_does_not_publish_if_there_are_errors_test.dart b/test/lish/force_does_not_publish_if_there_are_errors_test.dart
index 26978ad..58c12fa 100644
--- a/test/lish/force_does_not_publish_if_there_are_errors_test.dart
+++ b/test/lish/force_does_not_publish_if_there_are_errors_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -23,7 +21,7 @@
]).create();
await servePackages();
- var pub = await startPublish(globalPackageServer, args: ['--force']);
+ var pub = await startPublish(globalPackageServer!, args: ['--force']);
await pub.shouldExit(exit_codes.DATA);
expect(
diff --git a/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart b/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
index 59c8233..cc05354 100644
--- a/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
+++ b/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -19,13 +17,13 @@
test('--force publishes if there are no warnings or errors', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer, args: ['--force']);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!, args: ['--force']);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/force_publishes_if_there_are_warnings_test.dart b/test/lish/force_publishes_if_there_are_warnings_test.dart
index c217b29..9797e9c 100644
--- a/test/lish/force_publishes_if_there_are_warnings_test.dart
+++ b/test/lish/force_publishes_if_there_are_warnings_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -24,13 +22,13 @@
await d.dir(appPath, [d.pubspec(pkg)]).create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer, args: ['--force']);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!, args: ['--force']);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/many_files_test.dart b/test/lish/many_files_test.dart
index 02db6b2..dfe13f3 100644
--- a/test/lish/many_files_test.dart
+++ b/test/lish/many_files_test.dart
@@ -2,11 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'dart:io';
-import 'dart:math' as math;
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -38,7 +35,7 @@
int argMax;
if (Platform.isWindows) {
// On Windows, the maximum argument list length is 8^5 bytes.
- argMax = math.pow(8, 5);
+ argMax = 32768; // 8^5
} else {
// On POSIX, the maximum argument list length can be retrieved
// automatically.
@@ -76,14 +73,14 @@
}
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/package_creation_provides_a_malformed_error_test.dart b/test/lish/package_creation_provides_a_malformed_error_test.dart
index d78e495..1587165 100644
--- a/test/lish/package_creation_provides_a_malformed_error_test.dart
+++ b/test/lish/package_creation_provides_a_malformed_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -18,15 +16,15 @@
test('package creation provides a malformed error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
var body = {'error': 'Your package was too boring.'};
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.notFound(jsonEncode(body));
});
diff --git a/test/lish/package_creation_provides_a_malformed_success_test.dart b/test/lish/package_creation_provides_a_malformed_success_test.dart
index 67c10ef..b47461f 100644
--- a/test/lish/package_creation_provides_a_malformed_success_test.dart
+++ b/test/lish/package_creation_provides_a_malformed_success_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -18,15 +16,15 @@
test('package creation provides a malformed success', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
var body = {'success': 'Your package was awesome.'};
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode(body));
});
diff --git a/test/lish/package_creation_provides_an_error_test.dart b/test/lish/package_creation_provides_an_error_test.dart
index 49166c1..a0c7153 100644
--- a/test/lish/package_creation_provides_an_error_test.dart
+++ b/test/lish/package_creation_provides_an_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -18,14 +16,14 @@
test('package creation provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.notFound(jsonEncode({
'error': {'message': 'Your package was too boring.'}
}));
diff --git a/test/lish/package_creation_provides_invalid_json_test.dart b/test/lish/package_creation_provides_invalid_json_test.dart
index 8cdfd5b..025d8f9 100644
--- a/test/lish/package_creation_provides_invalid_json_test.dart
+++ b/test/lish/package_creation_provides_invalid_json_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -16,14 +14,14 @@
test('package creation provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok('{not json');
});
diff --git a/test/lish/package_validation_has_a_warning_and_continues_test.dart b/test/lish/package_validation_has_a_warning_and_continues_test.dart
index ec55be9..15e9185 100644
--- a/test/lish/package_validation_has_a_warning_and_continues_test.dart
+++ b/test/lish/package_validation_has_a_warning_and_continues_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -24,13 +22,13 @@
await d.dir(appPath, [d.pubspec(pkg)]).create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
pub.stdin.writeln('y');
- handleUploadForm(globalPackageServer);
- handleUpload(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
+ handleUpload(globalPackageServer!);
- globalPackageServer.expect('GET', '/create', (request) {
+ globalPackageServer!.expect('GET', '/create', (request) {
return shelf.Response.ok(jsonEncode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
diff --git a/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart b/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart
index fbdacc4..c478b05 100644
--- a/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart
+++ b/test/lish/package_validation_has_a_warning_and_is_canceled_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -20,7 +18,7 @@
await d.dir(appPath, [d.pubspec(pkg)]).create();
await servePackages();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
pub.stdin.writeln('n');
await pub.shouldExit(exit_codes.DATA);
diff --git a/test/lish/package_validation_has_an_error_test.dart b/test/lish/package_validation_has_an_error_test.dart
index 9fab3a5..df747c6 100644
--- a/test/lish/package_validation_has_an_error_test.dart
+++ b/test/lish/package_validation_has_an_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -23,7 +21,7 @@
]).create();
await servePackages();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
await pub.shouldExit(exit_codes.DATA);
expect(
diff --git a/test/lish/preview_errors_if_private_test.dart b/test/lish/preview_errors_if_private_test.dart
index c816c6e..fb7160a 100644
--- a/test/lish/preview_errors_if_private_test.dart
+++ b/test/lish/preview_errors_if_private_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/preview_package_validation_has_a_warning_test.dart b/test/lish/preview_package_validation_has_a_warning_test.dart
index c3aa01d..bbb3967 100644
--- a/test/lish/preview_package_validation_has_a_warning_test.dart
+++ b/test/lish/preview_package_validation_has_a_warning_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -21,7 +19,7 @@
await d.dir(appPath, [d.pubspec(pkg)]).create();
await servePackages();
- var pub = await startPublish(globalPackageServer, args: ['--dry-run']);
+ var pub = await startPublish(globalPackageServer!, args: ['--dry-run']);
await pub.shouldExit(exit_codes.DATA);
expect(
diff --git a/test/lish/preview_package_validation_has_no_warnings_test.dart b/test/lish/preview_package_validation_has_no_warnings_test.dart
index 586708c..a1bffaf 100644
--- a/test/lish/preview_package_validation_has_no_warnings_test.dart
+++ b/test/lish/preview_package_validation_has_no_warnings_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
@@ -20,7 +18,7 @@
await d.dir(appPath, [d.pubspec(pkg)]).create();
await servePackages((_) {});
- var pub = await startPublish(globalPackageServer, args: ['--dry-run']);
+ var pub = await startPublish(globalPackageServer!, args: ['--dry-run']);
await pub.shouldExit(exit_codes.SUCCESS);
expect(pub.stderr, emitsThrough('Package has 0 warnings.'));
diff --git a/test/lish/server_arg_does_not_override_private_test.dart b/test/lish/server_arg_does_not_override_private_test.dart
index baba7d6..58a1af1 100644
--- a/test/lish/server_arg_does_not_override_private_test.dart
+++ b/test/lish/server_arg_does_not_override_private_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/server_arg_overrides_publish_to_url_test.dart b/test/lish/server_arg_overrides_publish_to_url_test.dart
index 508c0b3..b2d4c14 100644
--- a/test/lish/server_arg_overrides_publish_to_url_test.dart
+++ b/test/lish/server_arg_overrides_publish_to_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/upload_form_fields_has_a_non_string_value_test.dart b/test/lish/upload_form_fields_has_a_non_string_value_test.dart
index 3ecb2fb..3be8f4c 100644
--- a/test/lish/upload_form_fields_has_a_non_string_value_test.dart
+++ b/test/lish/upload_form_fields_has_a_non_string_value_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
@@ -17,8 +15,8 @@
test('upload form fields has a non-string value', () async {
await servePackages((_) {});
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
@@ -26,7 +24,7 @@
'url': 'http://example.com/upload',
'fields': {'field': 12}
};
- handleUploadForm(globalPackageServer, body);
+ handleUploadForm(globalPackageServer!, body);
expect(pub.stderr, emits('Invalid server response:'));
expect(pub.stderr, emits(jsonEncode(body)));
await pub.shouldExit(1);
diff --git a/test/lish/upload_form_fields_is_not_a_map_test.dart b/test/lish/upload_form_fields_is_not_a_map_test.dart
index fed0f38..53f36da 100644
--- a/test/lish/upload_form_fields_is_not_a_map_test.dart
+++ b/test/lish/upload_form_fields_is_not_a_map_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
@@ -17,13 +15,13 @@
test('upload form fields is not a map', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
var body = {'url': 'http://example.com/upload', 'fields': 12};
- handleUploadForm(globalPackageServer, body);
+ handleUploadForm(globalPackageServer!, body);
expect(pub.stderr, emits('Invalid server response:'));
expect(pub.stderr, emits(jsonEncode(body)));
await pub.shouldExit(1);
diff --git a/test/lish/upload_form_is_missing_fields_test.dart b/test/lish/upload_form_is_missing_fields_test.dart
index a49b0d6..27036f6 100644
--- a/test/lish/upload_form_is_missing_fields_test.dart
+++ b/test/lish/upload_form_is_missing_fields_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
@@ -17,13 +15,13 @@
test('upload form is missing fields', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
var body = {'url': 'http://example.com/upload'};
- handleUploadForm(globalPackageServer, body);
+ handleUploadForm(globalPackageServer!, body);
expect(pub.stderr, emits('Invalid server response:'));
expect(pub.stderr, emits(jsonEncode(body)));
await pub.shouldExit(1);
diff --git a/test/lish/upload_form_is_missing_url_test.dart b/test/lish/upload_form_is_missing_url_test.dart
index 50f5fa5..f9f6e8b 100644
--- a/test/lish/upload_form_is_missing_url_test.dart
+++ b/test/lish/upload_form_is_missing_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
@@ -17,8 +15,8 @@
test('upload form is missing url', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
@@ -26,7 +24,7 @@
'fields': {'field1': 'value1', 'field2': 'value2'}
};
- handleUploadForm(globalPackageServer, body);
+ handleUploadForm(globalPackageServer!, body);
expect(pub.stderr, emits('Invalid server response:'));
expect(pub.stderr, emits(jsonEncode(body)));
await pub.shouldExit(1);
diff --git a/test/lish/upload_form_provides_an_error_test.dart b/test/lish/upload_form_provides_an_error_test.dart
index c5fd41e..1d9b0c5 100644
--- a/test/lish/upload_form_provides_an_error_test.dart
+++ b/test/lish/upload_form_provides_an_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -17,12 +15,12 @@
test('upload form provides an error', () async {
await servePackages((_) {});
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- globalPackageServer.extraHandlers['/api/packages/versions/new'] =
+ globalPackageServer!.extraHandlers['/api/packages/versions/new'] =
expectAsync1((request) {
expect(request.method, 'GET');
return shelf.Response.notFound(jsonEncode({
diff --git a/test/lish/upload_form_provides_invalid_json_test.dart b/test/lish/upload_form_provides_invalid_json_test.dart
index a4fa5d7..c0996f9 100644
--- a/test/lish/upload_form_provides_invalid_json_test.dart
+++ b/test/lish/upload_form_provides_invalid_json_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -15,12 +13,12 @@
test('upload form provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- globalPackageServer.expect('GET', '/api/packages/versions/new',
+ globalPackageServer!.expect('GET', '/api/packages/versions/new',
(request) => shelf.Response.ok('{not json'));
expect(
diff --git a/test/lish/upload_form_url_is_not_a_string_test.dart b/test/lish/upload_form_url_is_not_a_string_test.dart
index 99909a4..a999537 100644
--- a/test/lish/upload_form_url_is_not_a_string_test.dart
+++ b/test/lish/upload_form_url_is_not_a_string_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
@@ -17,8 +15,8 @@
test('upload form url is not a string', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
@@ -27,7 +25,7 @@
'fields': {'field1': 'value1', 'field2': 'value2'}
};
- handleUploadForm(globalPackageServer, body);
+ handleUploadForm(globalPackageServer!, body);
expect(pub.stderr, emits('Invalid server response:'));
expect(pub.stderr, emits(jsonEncode(body)));
await pub.shouldExit(1);
diff --git a/test/lish/uses_publish_to_url_test.dart b/test/lish/uses_publish_to_url_test.dart
index e7f9cf3..47496f7 100644
--- a/test/lish/uses_publish_to_url_test.dart
+++ b/test/lish/uses_publish_to_url_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/lish/utils.dart b/test/lish/utils.dart
index 5f18444..8e1ed5f 100644
--- a/test/lish/utils.dart
+++ b/test/lish/utils.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -11,7 +9,7 @@
import '../test_pub.dart';
-void handleUploadForm(PackageServer server, [Map body]) {
+void handleUploadForm(PackageServer server, [Map? body]) {
server.expect('GET', '/api/packages/versions/new', (request) {
expect(
request.headers, containsPair('authorization', 'Bearer access token'));
diff --git a/test/list_package_dirs/ignores_updated_pubspec_test.dart b/test/list_package_dirs/ignores_updated_pubspec_test.dart
index edec570..2524681 100644
--- a/test/list_package_dirs/ignores_updated_pubspec_test.dart
+++ b/test/list_package_dirs/ignores_updated_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
diff --git a/test/list_package_dirs/includes_dev_dependencies_test.dart b/test/list_package_dirs/includes_dev_dependencies_test.dart
index 10f4f56..61cc56b 100644
--- a/test/list_package_dirs/includes_dev_dependencies_test.dart
+++ b/test/list_package_dirs/includes_dev_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
diff --git a/test/list_package_dirs/lists_dependency_directories_test.dart b/test/list_package_dirs/lists_dependency_directories_test.dart
index 5d5b982..af019a6 100644
--- a/test/list_package_dirs/lists_dependency_directories_test.dart
+++ b/test/list_package_dirs/lists_dependency_directories_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
@@ -39,7 +37,7 @@
'packages': {
'foo': path.join(d.sandbox, 'foo', 'lib'),
'bar': path.join(d.sandbox, cachePath, 'hosted',
- 'localhost%58${globalServer.port}', 'bar-1.0.0', 'lib'),
+ 'localhost%58${globalServer!.port}', 'bar-1.0.0', 'lib'),
'myapp': canonicalize(path.join(d.sandbox, appPath, 'lib'))
},
'input_files': [
diff --git a/test/list_package_dirs/lockfile_error_test.dart b/test/list_package_dirs/lockfile_error_test.dart
index 16860f4..f4440ec 100644
--- a/test/list_package_dirs/lockfile_error_test.dart
+++ b/test/list_package_dirs/lockfile_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/list_package_dirs/missing_pubspec_test.dart b/test/list_package_dirs/missing_pubspec_test.dart
index d3c61de..83a58c2 100644
--- a/test/list_package_dirs/missing_pubspec_test.dart
+++ b/test/list_package_dirs/missing_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/list_package_dirs/no_lockfile_test.dart b/test/list_package_dirs/no_lockfile_test.dart
index 9e1078b..5939099 100644
--- a/test/list_package_dirs/no_lockfile_test.dart
+++ b/test/list_package_dirs/no_lockfile_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/list_package_dirs/pubspec_error_test.dart b/test/list_package_dirs/pubspec_error_test.dart
index 321e555..c282c5c 100644
--- a/test/list_package_dirs/pubspec_error_test.dart
+++ b/test/list_package_dirs/pubspec_error_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/lock_file_test.dart b/test/lock_file_test.dart
index 2faf8c5..4360c7c 100644
--- a/test/lock_file_test.dart
+++ b/test/lock_file_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/language_version.dart';
import 'package:pub/src/lock_file.dart';
import 'package:pub/src/package_name.dart';
@@ -24,14 +22,14 @@
@override
PackageRef parseRef(String name, description,
- {String containingPath, LanguageVersion languageVersion}) {
+ {String? containingPath, LanguageVersion? languageVersion}) {
if (!description.endsWith(' desc')) throw FormatException('Bad');
return PackageRef(name, this, description);
}
@override
PackageId parseId(String name, Version version, description,
- {String containingPath}) {
+ {String? containingPath}) {
if (!description.endsWith(' desc')) throw FormatException('Bad');
return PackageId(name, this, version, description);
}
@@ -81,13 +79,13 @@
expect(lockFile.packages.length, equals(2));
- var bar = lockFile.packages['bar'];
+ var bar = lockFile.packages['bar']!;
expect(bar.name, equals('bar'));
expect(bar.version, equals(Version(1, 2, 3)));
expect(bar.source, equals(fakeSource));
expect(bar.description, equals('bar desc'));
- var foo = lockFile.packages['foo'];
+ var foo = lockFile.packages['foo']!;
expect(foo.name, equals('foo'));
expect(foo.version, equals(Version(2, 3, 4)));
expect(foo.source, equals(fakeSource));
@@ -102,7 +100,7 @@
version: 1.2.3
description: foo desc
''', sources);
- var foo = lockFile.packages['foo'];
+ var foo = lockFile.packages['foo']!;
expect(foo.source, equals(sources['bad']));
});
@@ -263,7 +261,7 @@
});
expect(
- loadYaml(lockfile.serialize(null)),
+ loadYaml(lockfile.serialize('')),
equals({
'sdks': {'dart': 'any'},
'packages': {
diff --git a/test/must_pub_get_test.dart b/test/must_pub_get_test.dart
index edea182..3451fc7 100644
--- a/test/must_pub_get_test.dart
+++ b/test/must_pub_get_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -334,7 +332,7 @@
setUp(() async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'sdk': '>=1.0.0 <2.0.0'}
});
@@ -362,7 +360,7 @@
'current Flutter SDK', () async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'flutter': '>=1.0.0 <2.0.0'}
});
@@ -524,7 +522,7 @@
group("an overridden dependency's SDK constraint is unmatched", () {
setUp(() async {
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('bar', '1.0.0', pubspec: {
'environment': {'sdk': '0.0.0-fake'}
});
@@ -549,7 +547,7 @@
() async {
// Avoid using a path dependency because it triggers the full validation
// logic. We want to be sure SDK-validation works without that logic.
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '3.0.0', pubspec: {
'environment': {'flutter': '>=1.0.0 <2.0.0'}
});
diff --git a/test/no_packages_dir_test.dart b/test/no_packages_dir_test.dart
index cdd6351..3a88bc5 100644
--- a/test/no_packages_dir_test.dart
+++ b/test/no_packages_dir_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import 'descriptor.dart' as d;
diff --git a/test/oauth2/logout_test.dart b/test/oauth2/logout_test.dart
index 81d4125..7398884 100644
--- a/test/oauth2/logout_test.dart
+++ b/test/oauth2/logout_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -13,7 +11,7 @@
test('with an existing credentials file, deletes it.', () async {
await servePackages();
await d
- .credentialsFile(globalPackageServer, 'access token',
+ .credentialsFile(globalPackageServer!, 'access token',
refreshToken: 'refresh token',
expiration: DateTime.now().add(Duration(hours: 1)))
.create();
@@ -30,7 +28,7 @@
await servePackages();
await d
.credentialsFile(
- globalPackageServer,
+ globalPackageServer!,
'access token',
refreshToken: 'refresh token',
expiration: DateTime.now().add(Duration(hours: 1)),
@@ -39,7 +37,7 @@
await d
.legacyCredentialsFile(
- globalPackageServer,
+ globalPackageServer!,
'access token',
refreshToken: 'refresh token',
expiration: DateTime.now().add(Duration(hours: 1)),
diff --git a/test/oauth2/utils.dart b/test/oauth2/utils.dart
index b7d765e..dab8c92 100644
--- a/test/oauth2/utils.dart
+++ b/test/oauth2/utils.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -24,10 +22,10 @@
var line = await pub.stdout.next;
var match =
- RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]').firstMatch(line);
+ RegExp(r'[?&]redirect_uri=([0-9a-zA-Z.%+-]+)[$&]').firstMatch(line)!;
expect(match, isNotNull);
- var redirectUrl = Uri.parse(Uri.decodeComponent(match.group(1)));
+ var redirectUrl = Uri.parse(Uri.decodeComponent(match.group(1)!));
redirectUrl = _addQueryParameters(redirectUrl, {'code': 'access code'});
// Expect the /token request
@@ -61,8 +59,8 @@
}
/// Convert a [Map] from parameter names to values to a URL query string.
-String _mapToQuery(Map<String, String> map) {
- var pairs = <List<String>>[];
+String _mapToQuery(Map<String, String?> map) {
+ var pairs = <List<String?>>[];
map.forEach((key, value) {
key = Uri.encodeQueryComponent(key);
value = (value == null || value.isEmpty)
diff --git a/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart b/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart
index 5585526..79d89a7 100644
--- a/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart
+++ b/test/oauth2/with_a_malformed_credentials_authenticates_again_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -21,11 +19,11 @@
await d.dir(
configPath, [d.file('pub-credentials.json', '{bad json')]).create();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- await authorizePub(pub, globalPackageServer, 'new access token');
+ await authorizePub(pub, globalPackageServer!, 'new access token');
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
expect(request.headers,
containsPair('authorization', 'Bearer new access token'));
@@ -36,6 +34,8 @@
// do so rather than killing it so it'll write out the credentials file.
await pub.shouldExit(1);
- await d.credentialsFile(globalPackageServer, 'new access token').validate();
+ await d
+ .credentialsFile(globalPackageServer!, 'new access token')
+ .validate();
});
}
diff --git a/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart b/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart
index ad6559f..0ecd305 100644
--- a/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart
+++ b/test/oauth2/with_a_pre_existing_credentials_does_not_authenticate_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -14,8 +12,8 @@
await d.validPackage.create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
diff --git a/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart b/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
index 3354bbc..63a91d4 100644
--- a/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
+++ b/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -23,14 +21,14 @@
await servePackages();
await d
- .credentialsFile(globalPackageServer, 'access token',
+ .credentialsFile(globalPackageServer!, 'access token',
refreshToken: 'bad refresh token',
expiration: DateTime.now().subtract(Duration(hours: 1)))
.create();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
- globalPackageServer.expect('POST', '/token', (request) {
+ globalPackageServer!.expect('POST', '/token', (request) {
return request.read().drain().then((_) {
return shelf.Response(400,
body: jsonEncode({'error': 'invalid_request'}),
@@ -41,10 +39,10 @@
await confirmPublish(pub);
await expectLater(pub.stdout, emits(startsWith('Uploading...')));
- await authorizePub(pub, globalPackageServer, 'new access token');
+ await authorizePub(pub, globalPackageServer!, 'new access token');
var done = Completer();
- globalPackageServer.expect('GET', '/api/packages/versions/new',
+ globalPackageServer!.expect('GET', '/api/packages/versions/new',
(request) async {
expect(request.headers,
containsPair('authorization', 'Bearer new access token'));
diff --git a/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart b/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
index 16062a7..3d303a5 100644
--- a/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
+++ b/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -20,15 +18,15 @@
await servePackages();
await d
- .credentialsFile(globalPackageServer, 'access token',
+ .credentialsFile(globalPackageServer!, 'access token',
refreshToken: 'refresh token',
expiration: DateTime.now().subtract(Duration(hours: 1)))
.create();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- globalPackageServer.expect('POST', '/token', (request) {
+ globalPackageServer!.expect('POST', '/token', (request) {
return request.readAsString().then((body) {
expect(
body, matches(RegExp(r'(^|&)refresh_token=refresh\+token(&|$)')));
@@ -40,7 +38,7 @@
});
});
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
expect(request.headers,
containsPair('authorization', 'Bearer new access token'));
@@ -50,7 +48,7 @@
await pub.shouldExit();
await d
- .credentialsFile(globalPackageServer, 'new access token',
+ .credentialsFile(globalPackageServer!, 'new access token',
refreshToken: 'refresh token')
.validate();
});
diff --git a/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart b/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart
index 6437a5c..dbb4280 100644
--- a/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart
+++ b/test/oauth2/with_an_expired_credentials_without_a_refresh_token_authenticates_again_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -19,20 +17,20 @@
await servePackages();
await d
- .credentialsFile(globalPackageServer, 'access token',
+ .credentialsFile(globalPackageServer!, 'access token',
expiration: DateTime.now().subtract(Duration(hours: 1)))
.create();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
await expectLater(
pub.stderr,
emits("Pub's authorization to upload packages has expired and "
"can't be automatically refreshed."));
- await authorizePub(pub, globalPackageServer, 'new access token');
+ await authorizePub(pub, globalPackageServer!, 'new access token');
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
expect(request.headers,
containsPair('authorization', 'Bearer new access token'));
@@ -43,6 +41,8 @@
// do so rather than killing it so it'll write out the credentials file.
await pub.shouldExit(1);
- await d.credentialsFile(globalPackageServer, 'new access token').validate();
+ await d
+ .credentialsFile(globalPackageServer!, 'new access token')
+ .validate();
});
}
diff --git a/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart b/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart
index 2106960..fe7bc1b 100644
--- a/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart
+++ b/test/oauth2/with_no_credentials_authenticates_and_saves_credentials_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -18,11 +16,11 @@
await d.validPackage.create();
await servePackages();
- var pub = await startPublish(globalPackageServer);
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- await authorizePub(pub, globalPackageServer);
+ await authorizePub(pub, globalPackageServer!);
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
expect(request.headers,
containsPair('authorization', 'Bearer access token'));
@@ -33,6 +31,6 @@
// do so rather than killing it so it'll write out the credentials file.
await pub.shouldExit(1);
- await d.credentialsFile(globalPackageServer, 'access token').validate();
+ await d.credentialsFile(globalPackageServer!, 'access token').validate();
});
}
diff --git a/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart b/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
index 9ef5e69..433a9ed 100644
--- a/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
+++ b/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:shelf/shelf.dart' as shelf;
@@ -18,12 +16,12 @@
'credentials.json', () async {
await d.validPackage.create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPublish(globalPackageServer);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPublish(globalPackageServer!);
await confirmPublish(pub);
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
return shelf.Response(401,
body: jsonEncode({
'error': {'message': 'your token sucks'}
diff --git a/test/outdated/outdated_test.dart b/test/outdated/outdated_test.dart
index 2f47bbd..f2dee0c 100644
--- a/test/outdated/outdated_test.dart
+++ b/test/outdated/outdated_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import '../descriptor.dart' as d;
import '../golden_file.dart';
import '../test_pub.dart';
@@ -12,8 +10,8 @@
/// Try running 'pub outdated' with a number of different sets of arguments.
/// And compare to results from test/testdata/goldens/...
Future<void> runOutdatedTests({
- Map<String, String> environment,
- String workingDirectory,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async {
const commands = [
['outdated', '--json'],
@@ -90,7 +88,7 @@
})
]).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..serve('foo', '1.3.0', deps: {'transitive': '>=1.0.0<3.0.0'})
..serve('foo', '2.0.0',
deps: {'transitive': '>=1.0.0<3.0.0', 'transitive2': '^1.0.0'})
@@ -128,7 +126,7 @@
await pubGet();
- globalPackageServer.add(
+ globalPackageServer!.add(
(builder) => builder..serve('foo', '1.3.0', deps: {'app': '^1.0.1'}),
);
diff --git a/test/package_config_file_test.dart b/test/package_config_file_test.dart
index 8cb03f0..82882ae 100644
--- a/test/package_config_file_test.dart
+++ b/test/package_config_file_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/package_list_files_test.dart b/test/package_list_files_test.dart
index 921175d..091001b 100644
--- a/test/package_list_files_test.dart
+++ b/test/package_list_files_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as p;
@@ -15,8 +13,8 @@
import 'descriptor.dart' as d;
import 'test_pub.dart';
-String root;
-Entrypoint entrypoint;
+late String root;
+Entrypoint? entrypoint;
void main() {
test('lists files recursively', () async {
@@ -35,7 +33,7 @@
createEntrypoint();
expect(
- entrypoint.root.listFiles(),
+ entrypoint!.root.listFiles(),
unorderedEquals([
p.join(root, 'pubspec.yaml'),
p.join(root, 'file1.txt'),
@@ -71,7 +69,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -123,7 +121,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -151,7 +149,7 @@
createEntrypoint();
expect(
- () => entrypoint.root.listFiles(),
+ () => entrypoint!.root.listFiles(),
throwsA(
isA<DataException>().having(
(e) => e.message,
@@ -169,13 +167,13 @@
d.file('.foo', ''),
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, '.foo'),
p.join(root, 'pubspec.yaml'),
});
});
group('with git', () {
- d.GitRepoDescriptor repo;
+ late d.GitRepoDescriptor repo;
setUp(() async {
ensureGit();
repo = d.git(appPath, [d.appPubspec()]);
@@ -193,7 +191,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file1.txt'),
p.join(root, 'file2.txt'),
@@ -213,7 +211,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file2.text'),
p.join(root, 'subdir', 'subfile2.text')
@@ -246,7 +244,7 @@
createEntrypoint(p.join(appPath, 'rep', 'sub'));
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'file2.text'),
p.join(root, 'file4.gak'),
@@ -266,7 +264,7 @@
createEntrypoint(p.join(appPath, 'packages', 'app'));
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
});
});
@@ -286,7 +284,7 @@
});
test('respects its .gitignore with useGitIgnore', () {
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'submodule', 'file2.text'),
});
@@ -299,7 +297,7 @@
d.dir('subdir', [d.file('pubspec.lock')])
]).create();
- expect(entrypoint.root.listFiles(), {p.join(root, 'pubspec.yaml')});
+ expect(entrypoint!.root.listFiles(), {p.join(root, 'pubspec.yaml')});
});
test('ignores packages directories', () async {
@@ -310,7 +308,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {p.join(root, 'pubspec.yaml')});
+ expect(entrypoint!.root.listFiles(), {p.join(root, 'pubspec.yaml')});
});
test('allows pubspec.lock directories', () async {
@@ -320,7 +318,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'pubspec.lock', 'file.txt')
});
@@ -341,7 +339,7 @@
])
]).create();
- expect(entrypoint.root.listFiles(beneath: 'subdir'), {
+ expect(entrypoint!.root.listFiles(beneath: 'subdir'), {
p.join(root, 'subdir', 'subfile1.txt'),
p.join(root, 'subdir', 'subfile2.txt'),
p.join(root, 'subdir', 'subsubdir', 'subsubfile1.txt'),
@@ -360,7 +358,7 @@
d.dir('lib', [d.file('not_ignored.dart', 'content')]),
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'LICENSE'),
p.join(root, 'CHANGELOG.md'),
p.join(root, 'README.md'),
@@ -412,7 +410,7 @@
]).create();
createEntrypoint();
- expect(entrypoint.root.listFiles(), {
+ expect(entrypoint!.root.listFiles(), {
p.join(root, 'pubspec.yaml'),
p.join(root, 'not_ignored_by_gitignore.txt'),
p.join(root, 'ignored_by_gitignore.txt'),
@@ -427,7 +425,7 @@
});
}
-void createEntrypoint([String path]) {
+void createEntrypoint([String? path]) {
path ??= appPath;
root = p.join(d.sandbox, path);
entrypoint = Entrypoint(root, SystemCache(rootDir: root));
diff --git a/test/package_server.dart b/test/package_server.dart
index ec960ca..12b542a 100644
--- a/test/package_server.dart
+++ b/test/package_server.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -17,17 +15,17 @@
import 'test_pub.dart';
/// The current global [PackageServer].
-PackageServer get globalPackageServer => _globalPackageServer;
-PackageServer _globalPackageServer;
+PackageServer? get globalPackageServer => _globalPackageServer;
+PackageServer? _globalPackageServer;
/// Creates an HTTP server that replicates the structure of pub.dartlang.org and
/// makes it the current [globalServer].
///
/// Calls [callback] with a [PackageServerBuilder] that's used to specify
/// which packages to serve.
-Future servePackages([void Function(PackageServerBuilder) callback]) async {
+Future servePackages([void Function(PackageServerBuilder)? callback]) async {
_globalPackageServer = await PackageServer.start(callback ?? (_) {});
- globalServer = _globalPackageServer._inner;
+ globalServer = _globalPackageServer!._inner;
addTearDown(() {
_globalPackageServer = null;
@@ -44,10 +42,12 @@
///
/// If no server has been set up, an empty server will be started.
Future serveErrors() async {
- if (globalPackageServer == null) {
+ var packageServer = globalPackageServer;
+ if (packageServer == null) {
await serveNoPackages();
+ } else {
+ packageServer.serveErrors();
}
- globalPackageServer.serveErrors();
}
class PackageServer {
@@ -72,7 +72,7 @@
/// package to serve.
///
/// This is preserved so that additional packages can be added.
- PackageServerBuilder _builder;
+ late final PackageServerBuilder _builder;
/// The port used for the server.
int get port => _inner.port;
@@ -197,9 +197,9 @@
/// If [contents] is passed, it's used as the contents of the package. By
/// default, a package just contains a dummy lib directory.
void serve(String name, String version,
- {Map<String, dynamic> deps,
- Map<String, dynamic> pubspec,
- Iterable<d.Descriptor> contents}) {
+ {Map<String, dynamic>? deps,
+ Map<String, dynamic>? pubspec,
+ List<d.Descriptor>? contents}) {
var pubspecFields = <String, dynamic>{'name': name, 'version': version};
if (pubspec != null) pubspecFields.addAll(pubspec);
if (deps != null) pubspecFields['dependencies'] = deps;
@@ -213,8 +213,8 @@
// Mark a package discontinued.
void discontinue(String name,
- {bool isDiscontinued = true, String replacementText}) {
- _packages[name]
+ {bool isDiscontinued = true, String? replacementText}) {
+ _packages[name]!
..isDiscontinued = isDiscontinued
..discontinuedReplacementText = replacementText;
}
@@ -225,14 +225,14 @@
}
void retractPackageVersion(String name, String version) {
- _packages[name].versions[version].isRetracted = true;
+ _packages[name]!.versions[version]!.isRetracted = true;
}
}
class _ServedPackage {
final versions = <String, _ServedPackageVersion>{};
bool isDiscontinued = false;
- String discontinuedReplacementText;
+ String? discontinuedReplacementText;
}
/// A package that's intended to be served.
diff --git a/test/packages_file_test.dart b/test/packages_file_test.dart
index ce87d7c..67ca572 100644
--- a/test/packages_file_test.dart
+++ b/test/packages_file_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/pub_get_and_upgrade_test.dart b/test/pub_get_and_upgrade_test.dart
index b93d10f..62004a4 100644
--- a/test/pub_get_and_upgrade_test.dart
+++ b/test/pub_get_and_upgrade_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/pub_uploader_test.dart b/test/pub_uploader_test.dart
index c45c8ed..daec6bc 100644
--- a/test/pub_uploader_test.dart
+++ b/test/pub_uploader_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -42,11 +40,11 @@
test('adds an uploader', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) {
return request.readAsString().then((body) {
expect(body, equals('email=email'));
@@ -65,11 +63,11 @@
test('removes an uploader', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'email']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/email',
+ globalPackageServer!.expect('DELETE', '/api/packages/pkg/uploaders/email',
(request) {
return shelf.Response.ok(
jsonEncode({
@@ -86,10 +84,10 @@
await d.validPackage.create();
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
- var pub = await startPubUploader(globalPackageServer, ['add', 'email']);
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
+ var pub = await startPubUploader(globalPackageServer!, ['add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/test_pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/test_pkg/uploaders',
(request) {
return shelf.Response.ok(
jsonEncode({
@@ -104,11 +102,11 @@
test('add provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) {
return shelf.Response(400,
body: jsonEncode({
@@ -123,12 +121,12 @@
test('remove provides an error', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'e/mail']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'e/mail']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/e%2Fmail',
- (request) {
+ globalPackageServer!
+ .expect('DELETE', '/api/packages/pkg/uploaders/e%2Fmail', (request) {
return shelf.Response(400,
body: jsonEncode({
'error': {'message': 'Bad job!'}
@@ -142,11 +140,11 @@
test('add provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'add', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'add', 'email']);
- globalPackageServer.expect('POST', '/api/packages/pkg/uploaders',
+ globalPackageServer!.expect('POST', '/api/packages/pkg/uploaders',
(request) => shelf.Response.ok('{not json'));
expect(
@@ -158,11 +156,11 @@
test('remove provides invalid JSON', () async {
await servePackages();
- await d.credentialsFile(globalPackageServer, 'access token').create();
+ await d.credentialsFile(globalPackageServer!, 'access token').create();
var pub = await startPubUploader(
- globalPackageServer, ['--package', 'pkg', 'remove', 'email']);
+ globalPackageServer!, ['--package', 'pkg', 'remove', 'email']);
- globalPackageServer.expect('DELETE', '/api/packages/pkg/uploaders/email',
+ globalPackageServer!.expect('DELETE', '/api/packages/pkg/uploaders/email',
(request) => shelf.Response.ok('{not json'));
expect(
diff --git a/test/pubspec_test.dart b/test/pubspec_test.dart
index c293d85..62f77c4 100644
--- a/test/pubspec_test.dart
+++ b/test/pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/language_version.dart';
import 'package:pub/src/package_name.dart';
import 'package:pub/src/pubspec.dart';
@@ -24,14 +22,14 @@
@override
PackageRef parseRef(String name, description,
- {String containingPath, LanguageVersion languageVersion}) {
+ {String? containingPath, LanguageVersion? languageVersion}) {
if (description != 'ok') throw FormatException('Bad');
return PackageRef(name, this, description);
}
@override
PackageId parseId(String name, Version version, description,
- {String containingPath}) =>
+ {String? containingPath}) =>
PackageId(name, this, version, description);
@override
@@ -52,7 +50,7 @@
var throwsPubspecException = throwsA(const TypeMatcher<PubspecException>());
void expectPubspecException(String contents, void Function(Pubspec) fn,
- [String expectedContains]) {
+ [String? expectedContains]) {
var expectation = const TypeMatcher<PubspecException>();
if (expectedContains != null) {
expectation = expectation.having(
@@ -90,7 +88,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -105,7 +103,7 @@
version: ">=1.2.3 <0.0.0"
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.isEmpty, isTrue);
});
@@ -126,7 +124,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.devDependencies['foo'];
+ var foo = pubspec.devDependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -149,7 +147,7 @@
version: ">=1.2.3 <3.4.5"
''', sources);
- var foo = pubspec.dependencyOverrides['foo'];
+ var foo = pubspec.dependencyOverrides['foo']!;
expect(foo.name, equals('foo'));
expect(foo.constraint.allows(Version(1, 2, 3)), isTrue);
expect(foo.constraint.allows(Version(1, 2, 5)), isTrue);
@@ -171,7 +169,7 @@
unknown: blah
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.source, equals(sources['unknown']));
});
@@ -183,7 +181,7 @@
version: 1.2.3
''', sources);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
expect(foo.source, equals(sources['hosted']));
});
@@ -310,10 +308,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'bar',
});
@@ -333,10 +331,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'foo',
});
@@ -355,10 +353,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://example.org/pub/',
'name': 'foo',
});
@@ -377,10 +375,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://pub.dartlang.org',
'name': 'bar',
});
@@ -402,7 +400,7 @@
() => pubspec.dependencies,
throwsA(
isA<PubspecException>()
- .having((e) => e.span.text, 'span.text', 'invalid value'),
+ .having((e) => e.span!.text, 'span.text', 'invalid value'),
),
);
},
@@ -418,10 +416,10 @@
sources,
);
- var foo = pubspec.dependencies['foo'];
+ var foo = pubspec.dependencies['foo']!;
expect(foo.name, equals('foo'));
- expect(foo.source.name, 'hosted');
- expect(foo.source.serializeDescription(null, foo.description), {
+ expect(foo.source!.name, 'hosted');
+ expect(foo.source!.serializeDescription('', foo.description), {
'url': 'https://pub.dartlang.org',
'name': 'foo',
});
@@ -714,7 +712,7 @@
''', sources);
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.name, equals('foobar'));
expect(feature.onByDefault, isTrue);
expect(feature.dependencies, isEmpty);
@@ -751,7 +749,7 @@
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.sdkConstraints,
containsPair('dart', VersionConstraint.parse('^1.0.0')));
expect(feature.sdkConstraints,
@@ -770,7 +768,7 @@
Pubspec.parse('features: {foobar: {default: false}}', sources);
expect(pubspec.features, contains('foobar'));
- expect(pubspec.features['foobar'].onByDefault, isFalse);
+ expect(pubspec.features['foobar']!.onByDefault, isFalse);
});
test('parses valid dependency specifications', () {
@@ -784,7 +782,7 @@
expect(pubspec.features, contains('foobar'));
- var feature = pubspec.features['foobar'];
+ var feature = pubspec.features['foobar']!;
expect(feature.name, equals('foobar'));
expect(feature.onByDefault, isTrue);
expect(feature.dependencies, hasLength(2));
@@ -800,7 +798,7 @@
test('can be null', () {
var pubspec =
Pubspec.parse('features: {foobar: {requires: null}}', sources);
- expect(pubspec.features['foobar'].requires, isEmpty);
+ expect(pubspec.features['foobar']!.requires, isEmpty);
});
test('must be a list', () {
diff --git a/test/pubspec_utils_test.dart b/test/pubspec_utils_test.dart
index 60863f4..6622c1c 100644
--- a/test/pubspec_utils_test.dart
+++ b/test/pubspec_utils_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/pubspec_utils.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:test/test.dart';
@@ -47,8 +45,10 @@
});
test('works on compatible version union', () {
- final constraint1 = VersionConstraint.parse('>=1.2.3 <2.0.0');
- final constraint2 = VersionConstraint.parse('>2.2.3 <=4.0.0');
+ final constraint1 =
+ VersionConstraint.parse('>=1.2.3 <2.0.0') as VersionRange;
+ final constraint2 =
+ VersionConstraint.parse('>2.2.3 <=4.0.0') as VersionRange;
final constraint = VersionUnion.fromRanges([constraint1, constraint2]);
final removedUpperBound = stripUpperBound(constraint) as VersionRange;
diff --git a/test/rate_limited_scheduler_test.dart b/test/rate_limited_scheduler_test.dart
index 632efbf..e94bbc7 100644
--- a/test/rate_limited_scheduler_test.dart
+++ b/test/rate_limited_scheduler_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'package:pedantic/pedantic.dart';
@@ -19,8 +17,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -30,11 +28,11 @@
preschedule('b');
preschedule('c');
await Future.wait(
- [isBeingProcessed['a'].future, isBeingProcessed['b'].future]);
- expect(isBeingProcessed['c'].isCompleted, isFalse);
- completers['a'].complete();
- await isBeingProcessed['c'].future;
- completers['c'].complete();
+ [isBeingProcessed['a']!.future, isBeingProcessed['b']!.future]);
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
+ completers['a']!.complete();
+ await isBeingProcessed['c']!.future;
+ completers['c']!.complete();
expect(await scheduler.schedule('c'), 'C');
});
});
@@ -45,8 +43,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -57,18 +55,18 @@
preschedule1('a');
preschedule2('b');
preschedule1('c');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
// b, c should not start processing due to rate-limiting.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
- expect(isBeingProcessed['c'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
});
- completers['a'].complete();
+ completers['a']!.complete();
// b is removed from the queue, now c should start processing.
- await isBeingProcessed['c'].future;
- completers['c'].complete();
+ await isBeingProcessed['c']!.future;
+ completers['c']!.complete();
expect(await scheduler.schedule('c'), 'C');
// b is not on the queue anymore.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
});
});
@@ -78,27 +76,27 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
final scheduler = RateLimitedScheduler(f, maxConcurrentOperations: 1);
- Future b;
+ Future? b;
await scheduler.withPrescheduling((preschedule) async {
preschedule('a');
preschedule('b');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
// b should not start processing due to rate-limiting.
- expect(isBeingProcessed['b'].isCompleted, isFalse);
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
b = scheduler.schedule('b');
});
- completers['a'].complete();
+ completers['a']!.complete();
expect(await scheduler.schedule('a'), 'A');
// b was scheduled, so it should get processed now
- await isBeingProcessed['b'].future;
- completers['b'].complete();
+ await isBeingProcessed['b']!.future;
+ completers['b']!.complete();
expect(await b, 'B');
});
@@ -107,14 +105,14 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
final scheduler = RateLimitedScheduler(f, maxConcurrentOperations: 2);
- completers['a'].complete();
+ completers['a']!.complete();
expect(await scheduler.schedule('a'), 'A');
// Would fail if isBeingProcessed['a'] was completed twice
expect(await scheduler.schedule('a'), 'A');
@@ -125,8 +123,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -134,12 +132,12 @@
await scheduler.withPrescheduling((preschedule) async {
preschedule('a');
preschedule('b');
- await isBeingProcessed['a'].future;
+ await isBeingProcessed['a']!.future;
final cResult = scheduler.schedule('c');
- expect(isBeingProcessed['b'].isCompleted, isFalse);
- completers['a'].complete();
- completers['c'].complete();
- await isBeingProcessed['c'].future;
+ expect(isBeingProcessed['b']!.isCompleted, isFalse);
+ completers['a']!.complete();
+ completers['c']!.complete();
+ await isBeingProcessed['c']!.future;
// 'c' is done before we allow 'b' to finish processing
expect(await cResult, 'C');
});
@@ -150,8 +148,8 @@
final isBeingProcessed = threeCompleters();
Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return i.toUpperCase();
}
@@ -161,14 +159,15 @@
preschedule('a');
preschedule('b');
preschedule('c');
- await isBeingProcessed['a'].future;
- await isBeingProcessed['b'].future;
- expect(isBeingProcessed['c'].isCompleted, isFalse);
- unawaited(completers['c'].future.catchError((_) {}));
- completers['c'].completeError('errorC');
- completers['a'].completeError('errorA');
- await isBeingProcessed['c'].future;
- completers['b'].completeError('errorB');
+
+ await isBeingProcessed['a']!.future;
+ await isBeingProcessed['b']!.future;
+ expect(isBeingProcessed['c']!.isCompleted, isFalse);
+ unawaited(completers['c']!.future.catchError((_) {}));
+ completers['c']!.completeError('errorC');
+ completers['a']!.completeError('errorA');
+ await isBeingProcessed['c']!.future;
+ completers['b']!.completeError('errorB');
expect(() async => await scheduler.schedule('a'), throwsA('errorA'));
expect(() async => await scheduler.schedule('b'), throwsA('errorB'));
expect(() async => await scheduler.schedule('c'), throwsA('errorC'));
@@ -179,9 +178,9 @@
final completers = threeCompleters();
final isBeingProcessed = threeCompleters();
- Future<String> f(String i) async {
- isBeingProcessed[i].complete();
- await completers[i].future;
+ Future<String?> f(String i) async {
+ isBeingProcessed[i]!.complete();
+ await completers[i]!.future;
return Zone.current['zoneValue'];
}
@@ -198,16 +197,16 @@
}, zoneValues: {'zoneValue': 'C'});
await runZoned(() async {
- await isBeingProcessed['a'].future;
- await isBeingProcessed['b'].future;
+ await isBeingProcessed['a']!.future;
+ await isBeingProcessed['b']!.future;
// This will put 'c' in front of the queue, but in a zone with zoneValue
// bound to S.
final f = expectLater(scheduler.schedule('c'), completion('S'));
- completers['a'].complete();
- completers['b'].complete();
+ completers['a']!.complete();
+ completers['b']!.complete();
expect(await scheduler.schedule('a'), 'A');
expect(await scheduler.schedule('b'), 'B');
- completers['c'].complete();
+ completers['c']!.complete();
await f;
}, zoneValues: {'zoneValue': 'S'});
});
diff --git a/test/real_version_test.dart b/test/real_version_test.dart
index 484a7f6..80afab7 100644
--- a/test/real_version_test.dart
+++ b/test/real_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io';
import 'package:path/path.dart' as path;
diff --git a/test/reformat_ranges_test.dart b/test/reformat_ranges_test.dart
index 4af9cf7..35b085f 100644
--- a/test/reformat_ranges_test.dart
+++ b/test/reformat_ranges_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/package_name.dart';
import 'package:pub/src/solver/reformat_ranges.dart';
import 'package:pub/src/utils.dart';
diff --git a/test/remove/remove_test.dart b/test/remove/remove_test.dart
index 777d41b..52194c9 100644
--- a/test/remove/remove_test.dart
+++ b/test/remove/remove_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:io' show File;
import 'package:path/path.dart' as p;
diff --git a/test/run/allows_dart_extension_test.dart b/test/run/allows_dart_extension_test.dart
index f88e9bd..27640fc 100644
--- a/test/run/allows_dart_extension_test.dart
+++ b/test/run/allows_dart_extension_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/app_can_read_from_stdin_test.dart b/test/run/app_can_read_from_stdin_test.dart
index a0c3983..20f9b32 100644
--- a/test/run/app_can_read_from_stdin_test.dart
+++ b/test/run/app_can_read_from_stdin_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/enable_experiments_test.dart b/test/run/enable_experiments_test.dart
index 95468f0..dd6512b 100644
--- a/test/run/enable_experiments_test.dart
+++ b/test/run/enable_experiments_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/errors_if_no_executable_is_given_test.dart b/test/run/errors_if_no_executable_is_given_test.dart
index 92f0073..3e5abd6 100644
--- a/test/run/errors_if_no_executable_is_given_test.dart
+++ b/test/run/errors_if_no_executable_is_given_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/errors_if_only_transitive_dependency_test.dart b/test/run/errors_if_only_transitive_dependency_test.dart
index d5d1601..71fcd3d 100644
--- a/test/run/errors_if_only_transitive_dependency_test.dart
+++ b/test/run/errors_if_only_transitive_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/errors_if_path_in_dependency_test.dart b/test/run/errors_if_path_in_dependency_test.dart
index 2affef7..329650b 100644
--- a/test/run/errors_if_path_in_dependency_test.dart
+++ b/test/run/errors_if_path_in_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/forwards_signal_posix_test.dart b/test/run/forwards_signal_posix_test.dart
index 17fb0ea..1a32be8 100644
--- a/test/run/forwards_signal_posix_test.dart
+++ b/test/run/forwards_signal_posix_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
// Windows doesn't support sending signals.
// TODO(sigurdm): Test this when vm-args are provided.
// This test doesn't work when we subprocess instead of an isolate
diff --git a/test/run/includes_parent_directories_of_entrypoint_test.dart b/test/run/includes_parent_directories_of_entrypoint_test.dart
index f17b548..d351ac4 100644
--- a/test/run/includes_parent_directories_of_entrypoint_test.dart
+++ b/test/run/includes_parent_directories_of_entrypoint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/run/loads_package_imports_in_a_dependency_test.dart b/test/run/loads_package_imports_in_a_dependency_test.dart
index 66c261d..7bfb047 100644
--- a/test/run/loads_package_imports_in_a_dependency_test.dart
+++ b/test/run/loads_package_imports_in_a_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/nonexistent_dependency_test.dart b/test/run/nonexistent_dependency_test.dart
index 5b0f941..2051149 100644
--- a/test/run/nonexistent_dependency_test.dart
+++ b/test/run/nonexistent_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/nonexistent_script_in_dependency_test.dart b/test/run/nonexistent_script_in_dependency_test.dart
index 5153c25..62816df 100644
--- a/test/run/nonexistent_script_in_dependency_test.dart
+++ b/test/run/nonexistent_script_in_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/nonexistent_script_test.dart b/test/run/nonexistent_script_test.dart
index 9930430..0e12ee1 100644
--- a/test/run/nonexistent_script_test.dart
+++ b/test/run/nonexistent_script_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/run/package_api_test.dart b/test/run/package_api_test.dart
index e7b814f..161cbf9 100644
--- a/test/run/package_api_test.dart
+++ b/test/run/package_api_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
@@ -76,7 +74,7 @@
expect(pub.stdout,
emits(p.toUri(p.join(d.sandbox, 'myapp/lib/resource.txt')).toString()));
var fooResourcePath = p.join(
- globalPackageServer.pathInCache('foo', '1.0.0'), 'lib/resource.txt');
+ globalPackageServer!.pathInCache('foo', '1.0.0'), 'lib/resource.txt');
expect(pub.stdout, emits(p.toUri(fooResourcePath).toString()));
await pub.shouldExit(0);
});
diff --git a/test/run/passes_along_arguments_test.dart b/test/run/passes_along_arguments_test.dart
index d2beebf..66a7d53 100644
--- a/test/run/passes_along_arguments_test.dart
+++ b/test/run/passes_along_arguments_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/precompile_test.dart b/test/run/precompile_test.dart
index ac663d5..ef8787d 100644
--- a/test/run/precompile_test.dart
+++ b/test/run/precompile_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_app_in_directory_in_entrypoint_test.dart b/test/run/runs_app_in_directory_in_entrypoint_test.dart
index ef720c5..ac8af0d 100644
--- a/test/run/runs_app_in_directory_in_entrypoint_test.dart
+++ b/test/run/runs_app_in_directory_in_entrypoint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
diff --git a/test/run/runs_app_in_entrypoint_test.dart b/test/run/runs_app_in_entrypoint_test.dart
index 3f3ed38..27a7381 100644
--- a/test/run/runs_app_in_entrypoint_test.dart
+++ b/test/run/runs_app_in_entrypoint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_from_a_dependency_override_after_dependency_test.dart b/test/run/runs_from_a_dependency_override_after_dependency_test.dart
index c3cde77..f7e7c7a 100644
--- a/test/run/runs_from_a_dependency_override_after_dependency_test.dart
+++ b/test/run/runs_from_a_dependency_override_after_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_named_app_in_dependency_test.dart b/test/run/runs_named_app_in_dependency_test.dart
index d554eb4..8f3d73d 100644
--- a/test/run/runs_named_app_in_dependency_test.dart
+++ b/test/run/runs_named_app_in_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_named_app_in_dev_dependency_test.dart b/test/run/runs_named_app_in_dev_dependency_test.dart
index f1493d4..287f05b 100644
--- a/test/run/runs_named_app_in_dev_dependency_test.dart
+++ b/test/run/runs_named_app_in_dev_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_shorthand_app_in_dependency_test.dart b/test/run/runs_shorthand_app_in_dependency_test.dart
index cd3c66a..455e049 100644
--- a/test/run/runs_shorthand_app_in_dependency_test.dart
+++ b/test/run/runs_shorthand_app_in_dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_the_script_in_checked_mode_test.dart b/test/run/runs_the_script_in_checked_mode_test.dart
index 8b8e214..8b4010a 100644
--- a/test/run/runs_the_script_in_checked_mode_test.dart
+++ b/test/run/runs_the_script_in_checked_mode_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/run/runs_the_script_in_unchecked_mode_test.dart b/test/run/runs_the_script_in_unchecked_mode_test.dart
index da86989..2652706 100644
--- a/test/run/runs_the_script_in_unchecked_mode_test.dart
+++ b/test/run/runs_the_script_in_unchecked_mode_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/sdk_test.dart b/test/sdk_test.dart
index e9b7f1d..3f3b00b 100644
--- a/test/sdk_test.dart
+++ b/test/sdk_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:pub/src/io.dart';
diff --git a/test/snapshot_test.dart b/test/snapshot_test.dart
index 6ad44f6..215fcdf 100644
--- a/test/snapshot_test.dart
+++ b/test/snapshot_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
@@ -107,7 +105,7 @@
d.file('hello.dart-$versionSuffix.snapshot', contains('hello!'))
]).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '1.2.4', contents: [
d.dir('bin',
[d.file('hello.dart', "void main() => print('hello 2!');")])
@@ -153,7 +151,7 @@
d.file('hello.dart-$versionSuffix.snapshot', contains('hello!'))
]).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('bar', '1.2.4', contents: [
d.dir('lib', [d.file('bar.dart', "final message = 'hello 2!';")]),
]);
diff --git a/test/test_pub.dart b/test/test_pub.dart
index 2d68233..9f23e48 100644
--- a/test/test_pub.dart
+++ b/test/test_pub.dart
@@ -2,15 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
/// Test infrastructure for testing pub.
///
/// Unlike typical unit tests, most pub tests are integration tests that stage
/// some stuff on the file system, run pub, and then validate the results. This
/// library provides an API to build tests like that.
-import 'dart:async';
import 'dart:convert';
+import 'dart:core';
import 'dart:io';
import 'dart:isolate';
import 'dart:math';
@@ -28,7 +26,6 @@
import 'package:pub/src/io.dart';
import 'package:pub/src/lock_file.dart';
import 'package:pub/src/log.dart' as log;
-import 'package:pub/src/sdk.dart';
import 'package:pub/src/source_registry.dart';
import 'package:pub/src/system_cache.dart';
import 'package:pub/src/utils.dart';
@@ -82,7 +79,7 @@
orElse: () => null) as Map<String, dynamic>;
/// The suffix appended to a built snapshot.
-final versionSuffix = testVersion ?? sdk.version;
+final versionSuffix = testVersion;
/// Enum identifying a pub command that can be run with a well-defined success
/// output.
@@ -130,14 +127,14 @@
// TODO(rnystrom): Clean up other tests to call this when possible.
Future<void> pubCommand(
RunCommand command, {
- Iterable<String> args,
- output,
- error,
- silent,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory,
+ Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? silent,
+ Object? warning,
+ int? exitCode,
+ Map<String, String?>? environment,
+ String? workingDirectory,
includeParentEnvironment = true,
}) async {
if (error != null && warning != null) {
@@ -167,13 +164,13 @@
}
Future<void> pubAdd({
- Iterable<String> args,
- output,
- error,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory,
+ Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? warning,
+ int? exitCode,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async =>
await pubCommand(
RunCommand.add,
@@ -187,13 +184,13 @@
);
Future<void> pubGet({
- Iterable<String> args,
- output,
- error,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory,
+ Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? warning,
+ int? exitCode,
+ Map<String, String?>? environment,
+ String? workingDirectory,
bool includeParentEnvironment = true,
}) async =>
await pubCommand(
@@ -209,13 +206,13 @@
);
Future<void> pubUpgrade(
- {Iterable<String> args,
- output,
- error,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory}) async =>
+ {Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? warning,
+ int? exitCode,
+ Map<String, String>? environment,
+ String? workingDirectory}) async =>
await pubCommand(
RunCommand.upgrade,
args: args,
@@ -228,13 +225,13 @@
);
Future<void> pubDowngrade({
- Iterable<String> args,
- output,
- error,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory,
+ Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? warning,
+ int? exitCode,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async =>
await pubCommand(
RunCommand.downgrade,
@@ -248,13 +245,13 @@
);
Future<void> pubRemove({
- Iterable<String> args,
- output,
- error,
- warning,
- int exitCode,
- Map<String, String> environment,
- String workingDirectory,
+ Iterable<String>? args,
+ Object? output,
+ Object? error,
+ Object? warning,
+ int? exitCode,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async =>
await pubCommand(
RunCommand.remove,
@@ -276,8 +273,8 @@
/// Returns the `pub run` process.
Future<PubProcess> pubRun(
{bool global = false,
- Iterable<String> args,
- Map<String, String> environment,
+ required Iterable<String> args,
+ Map<String, String>? environment,
bool verbose = true}) async {
var pubArgs = global ? ['global', 'run'] : ['run'];
pubArgs.addAll(args);
@@ -321,15 +318,15 @@
/// If [environment] is given, any keys in it will override the environment
/// variables passed to the spawned process.
Future<void> runPub(
- {List<String> args,
- output,
- error,
- outputJson,
- silent,
- int exitCode,
- String workingDirectory,
- Map<String, String> environment,
- List<String> input,
+ {List<String>? args,
+ Object? output,
+ Object? error,
+ Object? outputJson,
+ Object? silent,
+ int? exitCode,
+ String? workingDirectory,
+ Map<String, String?>? environment,
+ List<String>? input,
includeParentEnvironment = true}) async {
exitCode ??= exit_codes.SUCCESS;
// Cannot pass both output and outputJson.
@@ -375,9 +372,9 @@
/// Any futures in [args] will be resolved before the process is started.
Future<PubProcess> startPublish(
PackageServer server, {
- List<String> args,
+ List<String>? args,
String authMethod = 'oauth2',
- Map<String, String> environment,
+ Map<String, String>? environment,
}) async {
var tokenEndpoint = Uri.parse(server.url).resolve('/token').toString();
args = ['lish', ...?args];
@@ -415,7 +412,7 @@
String testVersion = '0.1.2+3';
/// Gets the environment variables used to run pub in a test context.
-Map<String, String> getPubTestEnvironment([String tokenEndpoint]) {
+Map<String, String> getPubTestEnvironment([String? tokenEndpoint]) {
var environment = {
'CI': 'false', // unless explicitly given tests don't run pub in CI mode
'_PUB_TESTING': 'true',
@@ -431,8 +428,9 @@
environment['_PUB_TEST_TOKEN_ENDPOINT'] = tokenEndpoint;
}
- if (globalServer != null) {
- environment['PUB_HOSTED_URL'] = 'http://localhost:${globalServer.port}';
+ var server = globalServer;
+ if (server != null) {
+ environment['PUB_HOSTED_URL'] = 'http://localhost:${server.port}';
}
return environment;
@@ -455,10 +453,10 @@
/// If [environment] is given, any keys in it will override the environment
/// variables passed to the spawned process.
Future<PubProcess> startPub(
- {Iterable<String> args,
- String tokenEndpoint,
- String workingDirectory,
- Map<String, String> environment,
+ {Iterable<String>? args,
+ String? tokenEndpoint,
+ String? workingDirectory,
+ Map<String, String?>? environment,
bool verbose = true,
includeParentEnvironment = true}) async {
args ??= [];
@@ -484,10 +482,11 @@
final mergedEnvironment = getPubTestEnvironment(tokenEndpoint);
for (final e in (environment ?? {}).entries) {
- if (e.value == null) {
+ var value = e.value;
+ if (value == null) {
mergedEnvironment.remove(e.key);
} else {
- mergedEnvironment[e.key] = e.value;
+ mergedEnvironment[e.key] = value;
}
}
@@ -502,23 +501,23 @@
/// makes [stdout] and [stderr] work as though pub weren't running in verbose
/// mode.
class PubProcess extends TestProcess {
- StreamSplitter<Pair<log.Level, String>> get _logSplitter {
- __logSplitter ??= StreamSplitter(StreamGroup.merge([
+ late final StreamSplitter<Pair<log.Level, String>> _logSplitter =
+ createLogSplitter();
+
+ StreamSplitter<Pair<log.Level, String>> createLogSplitter() {
+ return StreamSplitter(StreamGroup.merge([
_outputToLog(super.stdoutStream(), log.Level.MESSAGE),
_outputToLog(super.stderrStream(), log.Level.ERROR)
]));
- return __logSplitter;
}
- StreamSplitter<Pair<log.Level, String>> __logSplitter;
-
static Future<PubProcess> start(String executable, Iterable<String> arguments,
- {String workingDirectory,
- Map<String, String> environment,
+ {String? workingDirectory,
+ Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
- String description,
- Encoding encoding,
+ String? description,
+ Encoding encoding = utf8,
bool forwardStdio = false}) async {
var process = await Process.start(executable, arguments.toList(),
workingDirectory: workingDirectory,
@@ -533,14 +532,13 @@
description = '$humanExecutable ${arguments.join(' ')}';
}
- encoding ??= utf8;
return PubProcess(process, description,
encoding: encoding, forwardStdio: forwardStdio);
}
/// This is protected.
PubProcess(process, description,
- {Encoding encoding, bool forwardStdio = false})
+ {Encoding encoding = utf8, bool forwardStdio = false})
: super(process, description,
encoding: encoding, forwardStdio: forwardStdio);
@@ -559,14 +557,14 @@
Stream<Pair<log.Level, String>> _outputToLog(
Stream<String> stream, log.Level defaultLevel) {
- log.Level lastLevel;
+ late log.Level lastLevel;
return stream.map((line) {
var match = _logLineRegExp.firstMatch(line);
if (match == null) return Pair<log.Level, String>(defaultLevel, line);
var level = _logLevels[match[1]] ?? lastLevel;
lastLevel = level;
- return Pair<log.Level, String>(level, match[2]);
+ return Pair<log.Level, String>(level, match[2]!);
});
}
@@ -616,15 +614,15 @@
/// [hosted] is a list of package names to version strings for dependencies on
/// hosted packages.
Future<void> createLockFile(String package,
- {Iterable<String> dependenciesInSandBox,
- Map<String, String> hosted}) async {
+ {Iterable<String>? dependenciesInSandBox,
+ Map<String, String>? hosted}) async {
var cache = SystemCache(rootDir: _pathInSandbox(cachePath));
var lockFile = _createLockFile(cache.sources,
sandbox: dependenciesInSandBox, hosted: hosted);
await d.dir(package, [
- d.file('pubspec.lock', lockFile.serialize(null)),
+ d.file('pubspec.lock', lockFile.serialize(p.join(d.sandbox, package))),
d.file(
'.packages',
lockFile.packagesFile(
@@ -639,8 +637,8 @@
/// Like [createLockFile], but creates only a `.packages` file without a
/// lockfile.
Future<void> createPackagesFile(String package,
- {Iterable<String> dependenciesInSandBox,
- Map<String, String> hosted}) async {
+ {Iterable<String>? dependenciesInSandBox,
+ Map<String, String>? hosted}) async {
var cache = SystemCache(rootDir: _pathInSandbox(cachePath));
var lockFile = _createLockFile(cache.sources,
sandbox: dependenciesInSandBox, hosted: hosted);
@@ -665,7 +663,7 @@
/// [hosted] is a list of package names to version strings for dependencies on
/// hosted packages.
LockFile _createLockFile(SourceRegistry sources,
- {Iterable<String> sandbox, Map<String, String> hosted}) {
+ {Iterable<String>? sandbox, Map<String, String>? hosted}) {
var dependencies = {};
if (sandbox != null) {
@@ -676,7 +674,9 @@
var packages = dependencies.keys.map((name) {
var dependencyPath = dependencies[name];
- return sources.path.idFor(name, Version(0, 0, 0), dependencyPath);
+ return sources.path.parseId(
+ name, Version(0, 0, 0), {'path': dependencyPath, 'relative': true},
+ containingPath: p.join(d.sandbox, appPath));
}).toList();
if (hosted != null) {
@@ -703,14 +703,14 @@
/// Describes a map representing a library package with the given [name],
/// [version], and [dependencies].
-Map packageMap(
+Map<String, Object> packageMap(
String name,
String version, [
- Map dependencies,
- Map devDependencies,
- Map environment,
+ Map? dependencies,
+ Map? devDependencies,
+ Map? environment,
]) {
- var package = <String, dynamic>{
+ var package = <String, Object>{
'name': name,
'version': version,
'homepage': 'http://pub.dartlang.org',
@@ -832,7 +832,7 @@
/// which may be a literal JSON object, or any other [Matcher].
void _validateOutputJson(
List<String> failures, String pipe, expected, String actualText) {
- Map actual;
+ late Map actual;
try {
actual = jsonDecode(actualText);
} on FormatException {
@@ -913,8 +913,9 @@
line = line
.replaceAll(d.sandbox, r'$SANDBOX')
.replaceAll(Platform.pathSeparator, '/');
- if (globalPackageServer != null) {
- line = line.replaceAll(globalPackageServer.port.toString(), '\$PORT');
+ var packageServer = globalPackageServer;
+ if (packageServer != null) {
+ line = line.replaceAll(packageServer.port.toString(), '\$PORT');
}
return line;
});
@@ -924,8 +925,8 @@
Future<void> runPubIntoBuffer(
List<String> args,
StringBuffer buffer, {
- Map<String, String> environment,
- String workingDirectory,
+ Map<String, String>? environment,
+ String? workingDirectory,
}) async {
final process = await startPub(
args: args,
diff --git a/test/token/add_token_test.dart b/test/token/add_token_test.dart
index 5e6b1f7..ca68c41 100644
--- a/test/token/add_token_test.dart
+++ b/test/token/add_token_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/token/error_message_test.dart b/test/token/error_message_test.dart
index c5ebc80..b7bc553 100644
--- a/test/token/error_message_test.dart
+++ b/test/token/error_message_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -11,7 +9,7 @@
import '../test_pub.dart';
void respondWithWwwAuthenticate(String headerValue) {
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
return shelf.Response(403, headers: {'www-authenticate': headerValue});
});
}
@@ -20,7 +18,7 @@
return runPub(
args: ['lish'],
environment: {
- 'PUB_HOSTED_URL': globalPackageServer.url,
+ 'PUB_HOSTED_URL': globalPackageServer!.url,
'_PUB_TEST_AUTH_METHOD': 'token',
},
exitCode: 65,
@@ -36,7 +34,7 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'token': 'access token'},
+ {'url': globalPackageServer!.url, 'token': 'access token'},
]
}).create();
});
diff --git a/test/token/remove_token_test.dart b/test/token/remove_token_test.dart
index 24fefa2..bfe2428 100644
--- a/test/token/remove_token_test.dart
+++ b/test/token/remove_token_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/token/token_authentication_test.dart b/test/token/token_authentication_test.dart
index 94574c7..667c47f 100644
--- a/test/token/token_authentication_test.dart
+++ b/test/token/token_authentication_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -18,14 +16,14 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'env': 'TOKEN'},
+ {'url': globalPackageServer!.url, 'env': 'TOKEN'},
]
}).create();
- var pub = await startPublish(globalPackageServer,
+ var pub = await startPublish(globalPackageServer!,
authMethod: 'token', environment: {'TOKEN': 'access token'});
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
await pub.shouldExit(1);
});
@@ -35,13 +33,13 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'token': 'access token'},
+ {'url': globalPackageServer!.url, 'token': 'access token'},
]
}).create();
- var pub = await startPublish(globalPackageServer, authMethod: 'token');
+ var pub = await startPublish(globalPackageServer!, authMethod: 'token');
await confirmPublish(pub);
- handleUploadForm(globalPackageServer);
+ handleUploadForm(globalPackageServer!);
await pub.shouldExit(1);
});
diff --git a/test/token/when_receives_401_removes_token_test.dart b/test/token/when_receives_401_removes_token_test.dart
index cb1f3e4..b674597 100644
--- a/test/token/when_receives_401_removes_token_test.dart
+++ b/test/token/when_receives_401_removes_token_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -18,13 +16,13 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'token': 'access token'},
+ {'url': globalPackageServer!.url, 'token': 'access token'},
]
}).create();
- var pub = await startPublish(globalPackageServer, authMethod: 'token');
+ var pub = await startPublish(globalPackageServer!, authMethod: 'token');
await confirmPublish(pub);
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
return shelf.Response(401);
});
diff --git a/test/token/when_receives_403_persists_saved_token_test.dart b/test/token/when_receives_403_persists_saved_token_test.dart
index 4035e5f..ffcbab0 100644
--- a/test/token/when_receives_403_persists_saved_token_test.dart
+++ b/test/token/when_receives_403_persists_saved_token_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:shelf/shelf.dart' as shelf;
import 'package:test/test.dart';
@@ -18,13 +16,13 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'token': 'access token'},
+ {'url': globalPackageServer!.url, 'token': 'access token'},
]
}).create();
- var pub = await startPublish(globalPackageServer, authMethod: 'token');
+ var pub = await startPublish(globalPackageServer!, authMethod: 'token');
await confirmPublish(pub);
- globalPackageServer.expect('GET', '/api/packages/versions/new', (request) {
+ globalPackageServer!.expect('GET', '/api/packages/versions/new', (request) {
return shelf.Response(403);
});
@@ -33,7 +31,7 @@
await d.tokensFile({
'version': 1,
'hosted': [
- {'url': globalPackageServer.url, 'token': 'access token'},
+ {'url': globalPackageServer!.url, 'token': 'access token'},
]
}).validate();
});
diff --git a/test/unknown_source_test.dart b/test/unknown_source_test.dart
index 241f9c7..fc53621 100644
--- a/test/unknown_source_test.dart
+++ b/test/unknown_source_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:convert';
import 'package:test/test.dart';
diff --git a/test/upgrade/dry_run_does_not_apply_changes_test.dart b/test/upgrade/dry_run_does_not_apply_changes_test.dart
index e77d3b8..de1e6b5 100644
--- a/test/upgrade/dry_run_does_not_apply_changes_test.dart
+++ b/test/upgrade/dry_run_does_not_apply_changes_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/io.dart';
import 'package:test/test.dart';
diff --git a/test/upgrade/example_warns_about_major_versions_test.dart b/test/upgrade/example_warns_about_major_versions_test.dart
index 259e787..a9b2965 100644
--- a/test/upgrade/example_warns_about_major_versions_test.dart
+++ b/test/upgrade/example_warns_about_major_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart = 2.11
-
import '../descriptor.dart' as d;
import '../golden_file.dart';
import '../test_pub.dart';
diff --git a/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart b/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
index dffb433..5638fb9 100644
--- a/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
+++ b/test/upgrade/git/do_not_upgrade_if_unneeded_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
diff --git a/test/upgrade/git/upgrade_locked_test.dart b/test/upgrade/git/upgrade_locked_test.dart
index 55938de..a8e744f 100644
--- a/test/upgrade/git/upgrade_locked_test.dart
+++ b/test/upgrade/git/upgrade_locked_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/git/upgrade_one_locked_test.dart b/test/upgrade/git/upgrade_one_locked_test.dart
index 14fa010..5c41fa6 100644
--- a/test/upgrade/git/upgrade_one_locked_test.dart
+++ b/test/upgrade/git/upgrade_one_locked_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart b/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
index 33f584c..e74a11e 100644
--- a/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
+++ b/test/upgrade/git/upgrade_to_incompatible_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/exit_codes.dart' as exit_codes;
import 'package:test/test.dart';
diff --git a/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart b/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
index e1e160f..ae865eb 100644
--- a/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
+++ b/test/upgrade/git/upgrade_to_nonexistent_pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/hosted/unlock_if_necessary_test.dart b/test/upgrade/hosted/unlock_if_necessary_test.dart
index 9bd78fb..5066727 100644
--- a/test/upgrade/hosted/unlock_if_necessary_test.dart
+++ b/test/upgrade/hosted/unlock_if_necessary_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -24,7 +22,7 @@
await d.appPackagesFile({'foo': '1.0.0', 'foo_dep': '1.0.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '2.0.0', deps: {'foo_dep': '>1.0.0'});
builder.serve('foo_dep', '2.0.0');
});
diff --git a/test/upgrade/hosted/unlock_single_package_test.dart b/test/upgrade/hosted/unlock_single_package_test.dart
index ba3d80f..29dabe7 100644
--- a/test/upgrade/hosted/unlock_single_package_test.dart
+++ b/test/upgrade/hosted/unlock_single_package_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -22,7 +20,7 @@
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.0.0'}).validate();
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '2.0.0', deps: {'bar': '<3.0.0'});
builder.serve('bar', '2.0.0');
});
@@ -33,7 +31,7 @@
await d.appPackagesFile({'foo': '1.0.0', 'bar': '1.0.0'}).validate();
// Introducing foo and bar 1.1.0, to show that only 'bar' will be upgraded
- globalPackageServer.add((builder) {
+ globalPackageServer!.add((builder) {
builder.serve('foo', '1.1.0', deps: {'bar': '<2.0.0'});
builder.serve('bar', '1.1.0');
});
diff --git a/test/upgrade/hosted/upgrade_removed_constraints_test.dart b/test/upgrade/hosted/upgrade_removed_constraints_test.dart
index bb73ddc..7c20816 100644
--- a/test/upgrade/hosted/upgrade_removed_constraints_test.dart
+++ b/test/upgrade/hosted/upgrade_removed_constraints_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/hosted/warn_about_discontinued_test.dart b/test/upgrade/hosted/warn_about_discontinued_test.dart
index 426e14d..8444c10 100644
--- a/test/upgrade/hosted/warn_about_discontinued_test.dart
+++ b/test/upgrade/hosted/warn_about_discontinued_test.dart
@@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -16,7 +15,7 @@
await d.appDir({'foo': '1.2.3'}).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
// We warn only about the direct dependency here:
@@ -27,7 +26,7 @@
No dependencies changed.
1 package is discontinued.
''');
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
// We warn only about the direct dependency here:
await pubUpgrade(output: '''
@@ -57,7 +56,7 @@
]).create();
await pubGet();
- globalPackageServer.add((builder) => builder
+ globalPackageServer!.add((builder) => builder
..discontinue('foo')
..discontinue('transitive'));
@@ -69,7 +68,7 @@
No dependencies changed.
1 package is discontinued.
''');
- globalPackageServer
+ globalPackageServer!
.add((builder) => builder.discontinue('foo', replacementText: 'bar'));
// We warn only about the direct dependency here:
await pubUpgrade(output: '''
diff --git a/test/upgrade/renamed_package_circular_dependency.dart b/test/upgrade/renamed_package_circular_dependency.dart
index 84ce151..ca033bb 100644
--- a/test/upgrade/renamed_package_circular_dependency.dart
+++ b/test/upgrade/renamed_package_circular_dependency.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
import '../test_pub.dart';
diff --git a/test/upgrade/report/describes_change_test.dart b/test/upgrade/report/describes_change_test.dart
index 382deb0..3d93541 100644
--- a/test/upgrade/report/describes_change_test.dart
+++ b/test/upgrade/report/describes_change_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
@@ -15,7 +13,7 @@
builder.serve('foo', '2.0.0');
});
- globalPackageServer.add((builder) => builder..discontinue('foo'));
+ globalPackageServer!.add((builder) => builder..discontinue('foo'));
// Create the first lockfile.
await d.appDir({'foo': '2.0.0'}).create();
diff --git a/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart b/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart
index 41f90d0..7a232d0 100644
--- a/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart
+++ b/test/upgrade/report/does_not_show_newer_versions_for_locked_packages_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/report/highlights_overrides_test.dart b/test/upgrade/report/highlights_overrides_test.dart
index 04ae0ba..94608d9 100644
--- a/test/upgrade/report/highlights_overrides_test.dart
+++ b/test/upgrade/report/highlights_overrides_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/report/leading_character_shows_change_test.dart b/test/upgrade/report/leading_character_shows_change_test.dart
index e7438d8..d7f870c 100644
--- a/test/upgrade/report/leading_character_shows_change_test.dart
+++ b/test/upgrade/report/leading_character_shows_change_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/report/shows_newer_available_versions_test.dart b/test/upgrade/report/shows_newer_available_versions_test.dart
index 54c32ad..4c1ca56 100644
--- a/test/upgrade/report/shows_newer_available_versions_test.dart
+++ b/test/upgrade/report/shows_newer_available_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/report/shows_number_of_changed_dependencies_test.dart b/test/upgrade/report/shows_number_of_changed_dependencies_test.dart
index 1c79302..5ba3af6 100644
--- a/test/upgrade/report/shows_number_of_changed_dependencies_test.dart
+++ b/test/upgrade/report/shows_number_of_changed_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/report/shows_pub_outdated_test.dart b/test/upgrade/report/shows_pub_outdated_test.dart
index 11d50da..9c0fa3d 100644
--- a/test/upgrade/report/shows_pub_outdated_test.dart
+++ b/test/upgrade/report/shows_pub_outdated_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../../descriptor.dart' as d;
diff --git a/test/upgrade/upgrade_major_versions_test.dart b/test/upgrade/upgrade_major_versions_test.dart
index 7ab389b..c312717 100644
--- a/test/upgrade/upgrade_major_versions_test.dart
+++ b/test/upgrade/upgrade_major_versions_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
diff --git a/test/upgrade/upgrade_null_safety_test.dart b/test/upgrade/upgrade_null_safety_test.dart
index 9c7dad0..921c737 100644
--- a/test/upgrade/upgrade_null_safety_test.dart
+++ b/test/upgrade/upgrade_null_safety_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
import '../test_pub.dart';
diff --git a/test/validator/changelog_test.dart b/test/validator/changelog_test.dart
index be166c3..5bef662 100644
--- a/test/validator/changelog_test.dart
+++ b/test/validator/changelog_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/changelog.dart';
diff --git a/test/validator/compiled_dartdoc_test.dart b/test/validator/compiled_dartdoc_test.dart
index a656958..f1d3d6d 100644
--- a/test/validator/compiled_dartdoc_test.dart
+++ b/test/validator/compiled_dartdoc_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/compiled_dartdoc.dart';
diff --git a/test/validator/dependency_override_test.dart b/test/validator/dependency_override_test.dart
index f459119..21a437d 100644
--- a/test/validator/dependency_override_test.dart
+++ b/test/validator/dependency_override_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/dependency_override.dart';
diff --git a/test/validator/dependency_test.dart b/test/validator/dependency_test.dart
index 00ab0c3..db9db15 100644
--- a/test/validator/dependency_test.dart
+++ b/test/validator/dependency_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:convert';
@@ -29,7 +27,7 @@
/// Sets up a test package with dependency [dep] and mocks a server with
/// [hostedVersions] of the package available.
-Future setUpDependency(Map dep, {List<String> hostedVersions}) {
+Future setUpDependency(Map dep, {List<String>? hostedVersions}) {
useMockClient(MockClient((request) {
expect(request.method, equals('GET'));
expect(request.url.path, equals('/api/packages/foo'));
diff --git a/test/validator/deprecated_fields_test.dart b/test/validator/deprecated_fields_test.dart
index a13774b..ee4551d 100644
--- a/test/validator/deprecated_fields_test.dart
+++ b/test/validator/deprecated_fields_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/deprecated_fields.dart';
diff --git a/test/validator/directory_test.dart b/test/validator/directory_test.dart
index 5a5ec99..7cc53b6 100644
--- a/test/validator/directory_test.dart
+++ b/test/validator/directory_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/directory.dart';
diff --git a/test/validator/executable_test.dart b/test/validator/executable_test.dart
index 555f768..d9973e7 100644
--- a/test/validator/executable_test.dart
+++ b/test/validator/executable_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/executable.dart';
diff --git a/test/validator/flutter_constraint_test.dart b/test/validator/flutter_constraint_test.dart
index 685c59d..b7bdf7c 100644
--- a/test/validator/flutter_constraint_test.dart
+++ b/test/validator/flutter_constraint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -20,7 +18,7 @@
}
Future<void> setup({
- String flutterConstraint,
+ String? flutterConstraint,
}) async {
final fakeFlutterRoot =
d.dir('fake_flutter_root', [d.file('version', '1.23.0')]);
diff --git a/test/validator/flutter_plugin_format_test.dart b/test/validator/flutter_plugin_format_test.dart
index cddeaf9..0c24bda 100644
--- a/test/validator/flutter_plugin_format_test.dart
+++ b/test/validator/flutter_plugin_format_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/flutter_plugin_format.dart';
diff --git a/test/validator/gitignore_test.dart b/test/validator/gitignore_test.dart
index 06d3be4..f7b02fe 100644
--- a/test/validator/gitignore_test.dart
+++ b/test/validator/gitignore_test.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
+import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:pub/src/exit_codes.dart' as exit_codes;
@@ -14,7 +14,7 @@
Future<void> expectValidation(
error,
int exitCode, {
- String workingDirectory,
+ String? workingDirectory,
}) async {
await runPub(
error: error,
@@ -84,4 +84,22 @@
exit_codes.DATA,
workingDirectory: packageRoot);
});
+
+ test('Should not follow symlinks', () async {
+ await d.git('myapp', [
+ ...d.validPackage.contents,
+ ]).create();
+ final packageRoot = p.join(d.sandbox, 'myapp');
+ await pubGet(
+ environment: {'_PUB_TEST_SDK_VERSION': '1.12.0'},
+ workingDirectory: packageRoot);
+
+ Link(p.join(packageRoot, '.abc', 'itself')).createSync(
+ packageRoot,
+ recursive: true,
+ );
+
+ await expectValidation(contains('Package has 0 warnings.'), 0,
+ workingDirectory: packageRoot);
+ });
}
diff --git a/test/validator/language_version_test.dart b/test/validator/language_version_test.dart
index 37431d4..39c9465 100644
--- a/test/validator/language_version_test.dart
+++ b/test/validator/language_version_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/language_version.dart';
@@ -17,7 +15,7 @@
LanguageVersionValidator(entrypoint);
Future<void> setup(
- {String sdkConstraint, String libraryLanguageVersion}) async {
+ {required String sdkConstraint, String? libraryLanguageVersion}) async {
await d.validPackage.create();
await d.dir(appPath, [
d.pubspec({
diff --git a/test/validator/leak_detection_test.dart b/test/validator/leak_detection_test.dart
index ee7d5d3..c055e59 100644
--- a/test/validator/leak_detection_test.dart
+++ b/test/validator/leak_detection_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/leak_detection.dart';
diff --git a/test/validator/license_test.dart b/test/validator/license_test.dart
index 77225b5..8717c75 100644
--- a/test/validator/license_test.dart
+++ b/test/validator/license_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/io.dart';
diff --git a/test/validator/name_test.dart b/test/validator/name_test.dart
index 5639c09..7cbb51c 100644
--- a/test/validator/name_test.dart
+++ b/test/validator/name_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/io.dart';
diff --git a/test/validator/null_safety_mixed_mode_test.dart b/test/validator/null_safety_mixed_mode_test.dart
index 6ec4746..e2a8dfb 100644
--- a/test/validator/null_safety_mixed_mode_test.dart
+++ b/test/validator/null_safety_mixed_mode_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../descriptor.dart' as d;
@@ -20,7 +18,7 @@
}
Future<void> setup({
- String sdkConstraint,
+ required String sdkConstraint,
Map dependencies = const {},
Map devDependencies = const {},
List<d.Descriptor> extraFiles = const [],
diff --git a/test/validator/pubspec_field_test.dart b/test/validator/pubspec_field_test.dart
index 7d4dbd7..8e6fefc 100644
--- a/test/validator/pubspec_field_test.dart
+++ b/test/validator/pubspec_field_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/pubspec_field.dart';
@@ -57,7 +55,7 @@
test('has executables', () async {
var pkg = packageMap('test_pkg', '1.0.0');
- pkg['executables'] = <String, String>{
+ pkg['executables'] = <String, String?>{
'test_pkg': null,
'test_pkg_helper': 'helper',
};
diff --git a/test/validator/pubspec_test.dart b/test/validator/pubspec_test.dart
index 0d964ce..9942220 100644
--- a/test/validator/pubspec_test.dart
+++ b/test/validator/pubspec_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/validator/pubspec.dart';
import 'package:test/test.dart';
diff --git a/test/validator/pubspec_typo_test.dart b/test/validator/pubspec_typo_test.dart
index efc731b..ab2a547 100644
--- a/test/validator/pubspec_typo_test.dart
+++ b/test/validator/pubspec_typo_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/pubspec_typo.dart';
diff --git a/test/validator/readme_test.dart b/test/validator/readme_test.dart
index 132ff6c..6519c6f 100644
--- a/test/validator/readme_test.dart
+++ b/test/validator/readme_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as p;
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/io.dart';
diff --git a/test/validator/relative_version_numbering_test.dart b/test/validator/relative_version_numbering_test.dart
index 0a9a1f7..07e8dbc 100644
--- a/test/validator/relative_version_numbering_test.dart
+++ b/test/validator/relative_version_numbering_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/relative_version_numbering.dart';
@@ -15,10 +13,10 @@
Validator validator(Entrypoint entrypoint) => RelativeVersionNumberingValidator(
entrypoint,
- Uri.parse(globalPackageServer.url),
+ Uri.parse(globalPackageServer!.url),
);
-Future<void> setup({String sdkConstraint}) async {
+Future<void> setup({required String sdkConstraint}) async {
await d.validPackage.create();
await d.dir(appPath, [
d.pubspec({
diff --git a/test/validator/sdk_constraint_test.dart b/test/validator/sdk_constraint_test.dart
index 1310d17..c24adf2 100644
--- a/test/validator/sdk_constraint_test.dart
+++ b/test/validator/sdk_constraint_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
import 'package:pub/src/validator/sdk_constraint.dart';
diff --git a/test/validator/size_test.dart b/test/validator/size_test.dart
index 37a746d..3a22e60 100644
--- a/test/validator/size_test.dart
+++ b/test/validator/size_test.dart
@@ -2,10 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
-import 'dart:math' as math;
import 'package:pub/src/validator/size.dart';
import 'package:test/test.dart';
@@ -20,7 +17,7 @@
Future<void> expectSizeValidationError(Matcher matcher) async {
await expectValidation(
- size(100 * math.pow(2, 20) + 1),
+ size(100 * 1048577 /*2^20 +1*/),
errors: contains(matcher),
);
}
@@ -30,7 +27,7 @@
await d.validPackage.create();
await expectValidation(size(100));
- await expectValidation(size(100 * math.pow(2, 20)));
+ await expectValidation(size(100 * 1048576 /*2^20*/));
});
group('considers a package invalid if it is more than 100 MB', () {
diff --git a/test/validator/strict_dependencies_test.dart b/test/validator/strict_dependencies_test.dart
index 0456413..7b7962a 100644
--- a/test/validator/strict_dependencies_test.dart
+++ b/test/validator/strict_dependencies_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:path/path.dart' as path;
import 'package:pub/src/entrypoint.dart';
import 'package:pub/src/validator.dart';
@@ -67,8 +65,8 @@
for (var port in ['import', 'export']) {
for (var isDev in [false, true]) {
- Map<String, String> deps;
- Map<String, String> devDeps;
+ Map<String, String>? deps;
+ Map<String, String>? devDeps;
if (isDev) {
devDeps = {'silly_monkey': '^1.2.3'};
diff --git a/test/validator/utils.dart b/test/validator/utils.dart
index 7eda0fd..5123683 100644
--- a/test/validator/utils.dart
+++ b/test/validator/utils.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'package:test/test.dart';
import '../test_pub.dart';
diff --git a/test/version_solver_test.dart b/test/version_solver_test.dart
index cf6f65f..261c493 100644
--- a/test/version_solver_test.dart
+++ b/test/version_solver_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
import 'dart:async';
import 'dart:io';
@@ -2974,11 +2972,11 @@
///
/// If [downgrade] is `true`, this runs "pub downgrade" instead of "pub get".
Future expectResolves(
- {Map result,
+ {Map? result,
error,
output,
- int tries,
- Map<String, String> environment,
+ int? tries,
+ Map<String, String>? environment,
bool downgrade = false}) async {
await runPub(
args: [downgrade ? 'downgrade' : 'get'],
@@ -3009,7 +3007,7 @@
// If the dep uses the default hosted source, grab it from the test
// package server rather than pub.dartlang.org.
dep = registry.hosted
- .refFor(dep.name, url: Uri.parse(globalPackageServer.url))
+ .refFor(dep.name, url: Uri.parse(globalPackageServer!.url))
.withConstraint(dep.constraint);
}
expect(dep.allows(id), isTrue, reason: 'Expected $id to match $dep.');
diff --git a/tool/extract_all_pub_dev.dart b/tool/extract_all_pub_dev.dart
index 8d7f049..f96dc5a 100644
--- a/tool/extract_all_pub_dev.dart
+++ b/tool/extract_all_pub_dev.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// @dart=2.10
-
/// This is a manual test that can be run to test the .tar.gz decoding.
/// It will save progress in [statusFileName] such that it doesn't have to be
/// finished in a single run.
@@ -33,7 +31,7 @@
Future<void> main() async {
var alreadyDonePackages = <String>{};
- var failures = <Map<String, dynamic>>[];
+ var failures = <Map<String, dynamic>?>[];
if (fileExists(statusFilename)) {
final json = jsonDecode(readTextFile(statusFilename));
for (final packageName in json['packages'] ?? []) {
diff --git a/tool/test-bin/pub_command_runner.dart b/tool/test-bin/pub_command_runner.dart
index 52eaf73..2be51e8 100644
--- a/tool/test-bin/pub_command_runner.dart
+++ b/tool/test-bin/pub_command_runner.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
/// A trivial embedding of the pub command. Used from tests.
-// @dart = 2.11
import 'dart:convert';
import 'dart:io';
@@ -17,7 +16,7 @@
final _LoggingAnalytics loggingAnalytics = _LoggingAnalytics();
class Runner extends CommandRunner<int> {
- ArgResults _options;
+ late ArgResults _options;
Runner() : super('pub_command_runner', 'Tests the embeddable pub command.') {
final analytics = Platform.environment['_PUB_LOG_ANALYTICS'] == 'true'
@@ -60,7 +59,7 @@
bool get firstRun => false;
@override
- Future sendScreenView(String viewName, {Map<String, String> parameters}) {
+ Future sendScreenView(String viewName, {Map<String, String>? parameters}) {
parameters ??= <String, String>{};
parameters['viewName'] = viewName;
return _log('screenView', parameters);
@@ -68,7 +67,7 @@
@override
Future sendEvent(String category, String action,
- {String label, int value, Map<String, String> parameters}) {
+ {String? label, int? value, Map<String, String>? parameters}) {
parameters ??= <String, String>{};
return _log(
'event',
@@ -82,7 +81,7 @@
@override
Future sendTiming(String variableName, int time,
- {String category, String label}) {
+ {String? category, String? label}) {
return _log('timing', {
'variableName': variableName,
'time': time,