Migrate another big chunk of the engine repo to `package:test` (#54853)
There are almost no behavioral changes.
Because `dart test` runs with assertions, and the former command does not, I had to tweak some of the engine tool tests because they would assert that there were duplicate names - but I didn't change any actual code besides the test expectations themselves/the fixtures.
This is not all of the engine, but is approximately 1/3 of all imports of `package:litetest` migrated.
diff --git a/ci/pubspec.yaml b/ci/pubspec.yaml
index 8749bff..b86c37b 100644
--- a/ci/pubspec.yaml
+++ b/ci/pubspec.yaml
@@ -20,6 +20,5 @@
process: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
+ engine_repo_tools: any
+ test: any
diff --git a/ci/test/format_test.dart b/ci/test/format_test.dart
index fffbba5..da06a2d 100644
--- a/ci/test/format_test.dart
+++ b/ci/test/format_test.dart
@@ -4,13 +4,13 @@
import 'dart:io' as io;
-import 'package:litetest/litetest.dart';
+import 'package:engine_repo_tools/engine_repo_tools.dart';
import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
import '../bin/format.dart' as target;
-final io.File script = io.File.fromUri(io.Platform.script).absolute;
-final io.Directory repoDir = script.parent.parent.parent;
+final io.Directory repoDir = Engine.findWithin().flutterDir;
class FileContentPair {
FileContentPair(this.original, this.formatted);
@@ -32,22 +32,21 @@
"if __name__=='__main__':\n sys.exit(\nMain(sys.argv)\n)\n",
"if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n");
final FileContentPair whitespaceContentPair = FileContentPair(
- 'int main() {\n return 0; \n}\n',
- 'int main() {\n return 0;\n}\n');
+ 'int main() {\n return 0; \n}\n', 'int main() {\n return 0;\n}\n');
final FileContentPair headerContentPair = FileContentPair(
- <String>[
- '#ifndef FOO_H_',
- '#define FOO_H_',
- '',
- '#endif // FOO_H_',
- ].join('\n'),
- <String>[
- '#ifndef FLUTTER_FORMAT_TEST_H_',
- '#define FLUTTER_FORMAT_TEST_H_',
- '',
- '#endif // FLUTTER_FORMAT_TEST_H_',
- '',
- ].join('\n'),
+ <String>[
+ '#ifndef FOO_H_',
+ '#define FOO_H_',
+ '',
+ '#endif // FOO_H_',
+ ].join('\n'),
+ <String>[
+ '#ifndef FLUTTER_FORMAT_TEST_H_',
+ '#define FLUTTER_FORMAT_TEST_H_',
+ '',
+ '#endif // FLUTTER_FORMAT_TEST_H_',
+ '',
+ ].join('\n'),
);
class TestFileFixture {
@@ -238,7 +237,8 @@
try {
fixture.gitAdd();
io.Process.runSync(
- formatterPath, <String>['--check', 'header', '--fix'],
+ formatterPath,
+ <String>['--check', 'header', '--fix'],
workingDirectory: repoDir.path,
);
final Iterable<FileContentPair> files = fixture.getFileContents();
diff --git a/testing/run_tests.py b/testing/run_tests.py
index 8495368..1564da7 100755
--- a/testing/run_tests.py
+++ b/testing/run_tests.py
@@ -966,10 +966,7 @@
# arguments to pass to each of the packages tests.
def build_dart_host_test_list(build_dir):
dart_host_tests = [
- (
- os.path.join('flutter', 'ci'),
- [os.path.join(BUILDROOT_DIR, 'flutter')],
- ),
+ (os.path.join('flutter', 'ci'), []),
(
os.path.join('flutter', 'flutter_frontend_server'),
[
diff --git a/tools/build_bucket_golden_scraper/pubspec.yaml b/tools/build_bucket_golden_scraper/pubspec.yaml
index 867bbe5..6677173 100644
--- a/tools/build_bucket_golden_scraper/pubspec.yaml
+++ b/tools/build_bucket_golden_scraper/pubspec.yaml
@@ -18,7 +18,4 @@
path: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
- smith: any
+ test: any
diff --git a/tools/build_bucket_golden_scraper/test/build_bucket_golden_scraper_test.dart b/tools/build_bucket_golden_scraper/test/build_bucket_golden_scraper_test.dart
index ff95e26..04d4065 100644
--- a/tools/build_bucket_golden_scraper/test/build_bucket_golden_scraper_test.dart
+++ b/tools/build_bucket_golden_scraper/test/build_bucket_golden_scraper_test.dart
@@ -5,10 +5,10 @@
import 'dart:io' as io;
import 'package:build_bucket_golden_scraper/build_bucket_golden_scraper.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
-int main(List<String> args) {
+void main() {
test('parses command-line arguments', () {
// Create a fake engine directory.
final io.Directory buildRoot = io.Directory.systemTemp.createTempSync('build_bucket_golden_scraper_test_engine');
@@ -69,6 +69,4 @@
buildRoot.deleteSync(recursive: true);
}
});
-
- return 0;
}
diff --git a/tools/dir_contents_diff/pubspec.yaml b/tools/dir_contents_diff/pubspec.yaml
index b7e3ad6..2e51ec4 100644
--- a/tools/dir_contents_diff/pubspec.yaml
+++ b/tools/dir_contents_diff/pubspec.yaml
@@ -9,5 +9,6 @@
resolution: workspace
dev_dependencies:
- litetest: any
+ engine_repo_tools: any
path: any
+ test: any
diff --git a/tools/dir_contents_diff/test/dir_contents_diff_test.dart b/tools/dir_contents_diff/test/dir_contents_diff_test.dart
index d2ed1c5..b8172f8 100644
--- a/tools/dir_contents_diff/test/dir_contents_diff_test.dart
+++ b/tools/dir_contents_diff/test/dir_contents_diff_test.dart
@@ -4,12 +4,17 @@
import 'dart:io' as io;
-import 'package:litetest/litetest.dart';
+import 'package:engine_repo_tools/engine_repo_tools.dart';
import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
void main() {
// Find a path to `dir_contents_diff.dart` from the working directory.
- final String pkgPath = io.File.fromUri(io.Platform.script).parent.parent.path;
+ final String pkgPath = p.join(
+ Engine.findWithin().flutterDir.path,
+ 'tools',
+ 'dir_contents_diff',
+ );
final String binPath = p.join(
pkgPath,
'bin',
@@ -44,7 +49,8 @@
});
test('lists files and diffs successfully, even with an EOF newline', () {
- final String goldenPath = p.join(pkgPath, 'test', 'file_ok_eof_newline.txt');
+ final String goldenPath =
+ p.join(pkgPath, 'test', 'file_ok_eof_newline.txt');
final String dirPath = p.join(pkgPath, 'test', 'fixtures');
final (int exitCode, String output) = runSync(goldenPath, dirPath);
if (exitCode != 0) {
@@ -67,7 +73,8 @@
});
test('diff fails when an unexpected file is present', () {
- final String goldenPath = p.join(pkgPath, 'test', 'file_bad_unexpected.txt');
+ final String goldenPath =
+ p.join(pkgPath, 'test', 'file_bad_unexpected.txt');
final String dirPath = p.join(pkgPath, 'test', 'fixtures');
final (int exitCode, String output) = runSync(goldenPath, dirPath);
if (exitCode == 0) {
diff --git a/tools/engine_tool/pubspec.yaml b/tools/engine_tool/pubspec.yaml
index f752846..d6b5b2a 100644
--- a/tools/engine_tool/pubspec.yaml
+++ b/tools/engine_tool/pubspec.yaml
@@ -24,5 +24,5 @@
process_runner: any
dev_dependencies:
- litetest: any
process_fakes: any
+ test: any
diff --git a/tools/engine_tool/test/build_command_test.dart b/tools/engine_tool/test/build_command_test.dart
index aebc181..47f803d 100644
--- a/tools/engine_tool/test/build_command_test.dart
+++ b/tools/engine_tool/test/build_command_test.dart
@@ -10,9 +10,9 @@
import 'package:engine_tool/src/commands/command_runner.dart';
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
import 'utils.dart';
@@ -38,7 +38,6 @@
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
'linux_test_config': linuxTestConfig,
- 'linux_test_config2': linuxTestConfig,
'mac_test_config': macTestConfig,
'win_test_config': winTestConfig,
};
@@ -53,8 +52,9 @@
cannedProcesses: cannedProcesses,
);
try {
- final List<Build> result = runnableBuilds(testEnv.environment, configs, true);
- expect(result.length, equals(8));
+ final List<Build> result =
+ runnableBuilds(testEnv.environment, configs, true);
+ expect(result.length, equals(4));
expect(result[0].name, equals('ci/build_name'));
} finally {
testEnv.cleanup();
@@ -123,7 +123,7 @@
expect(testEnv.processHistory.length, greaterThanOrEqualTo(3));
expect(
testEnv.processHistory[2].command,
- containsStringsInOrder(<String>['python3', 'gen/script.py']),
+ containsAllInOrder(<String>['python3', 'gen/script.py']),
);
} finally {
testEnv.cleanup();
@@ -251,7 +251,7 @@
expect(testEnv.processHistory[0].command[0],
contains(path.join('tools', 'gn')));
expect(testEnv.processHistory[0].command,
- doesNotContainAny(<String>['--rbe']));
+ isNot(contains(<String>['--rbe'])));
expect(testEnv.processHistory[1].command[0],
contains(path.join('ninja', 'ninja')));
} finally {
@@ -278,7 +278,7 @@
expect(testEnv.processHistory[0].command[0],
contains(path.join('tools', 'gn')));
expect(testEnv.processHistory[0].command,
- doesNotContainAny(<String>['--rbe']));
+ isNot(contains(<String>['--rbe'])));
expect(testEnv.processHistory[1].command[0],
contains(path.join('ninja', 'ninja')));
} finally {
@@ -305,7 +305,10 @@
);
try {
final Environment env = testEnv.environment;
- expectArgumentError(() => mangleConfigName(env, 'build'));
+ expect(
+ () => mangleConfigName(env, 'build'),
+ throwsArgumentError,
+ );
} finally {
testEnv.cleanup();
}
@@ -316,9 +319,9 @@
cannedProcesses: cannedProcesses,
);
try {
- final Environment env = testEnv.environment;
- expect(demangleConfigName(env, 'build'), equals('linux/build'));
- expect(demangleConfigName(env, 'ci/build'), equals('ci/build'));
+ final Environment env = testEnv.environment;
+ expect(demangleConfigName(env, 'build'), equals('linux/build'));
+ expect(demangleConfigName(env, 'ci/build'), equals('ci/build'));
} finally {
testEnv.cleanup();
}
@@ -453,9 +456,9 @@
test('build command gracefully handles no matched targets', () async {
final List<CannedProcess> cannedProcesses = <CannedProcess>[
- CannedProcess((List<String> command) =>
- command.contains('desc'),
- stdout: fixtures.gnDescOutputEmpty(gnPattern: 'testing/scenario_app:sceario_app'),
+ CannedProcess((List<String> command) => command.contains('desc'),
+ stdout: fixtures.gnDescOutputEmpty(
+ gnPattern: 'testing/scenario_app:sceario_app'),
exitCode: 1),
];
final TestEnvironment testEnv = TestEnvironment.withTestEngine(
@@ -496,7 +499,8 @@
help: true,
);
final int result = await runner.run(<String>[
- 'help', 'build',
+ 'help',
+ 'build',
]);
expect(result, equals(0));
} finally {
@@ -528,7 +532,8 @@
help: true,
);
final int result = await runner.run(<String>[
- 'help', 'build',
+ 'help',
+ 'build',
]);
expect(result, equals(0));
} finally {
diff --git a/tools/engine_tool/test/entry_point_test.dart b/tools/engine_tool/test/entry_point_test.dart
index 052b361..b7c9b05 100644
--- a/tools/engine_tool/test/entry_point_test.dart
+++ b/tools/engine_tool/test/entry_point_test.dart
@@ -5,10 +5,10 @@
import 'dart:io' as io;
import 'package:engine_repo_tools/engine_repo_tools.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
void main() {
final Engine engine;
diff --git a/tools/engine_tool/test/fetch_command_test.dart b/tools/engine_tool/test/fetch_command_test.dart
index 2488f44..8431a16 100644
--- a/tools/engine_tool/test/fetch_command_test.dart
+++ b/tools/engine_tool/test/fetch_command_test.dart
@@ -10,10 +10,10 @@
import 'package:engine_tool/src/commands/command_runner.dart';
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
void main() {
final Engine? engine = Engine.tryFindWithin();
@@ -62,7 +62,7 @@
expect(runHistory.length, greaterThanOrEqualTo(1));
expect(
runHistory[0],
- containsStringsInOrder(<String>['gclient', 'sync', '-D']),
+ containsAllInOrder(<String>['gclient', 'sync', '-D']),
);
});
@@ -78,7 +78,7 @@
expect(runHistory.length, greaterThanOrEqualTo(1));
expect(
runHistory[0],
- containsStringsInOrder(<String>['gclient', 'sync', '-D']),
+ containsAllInOrder(<String>['gclient', 'sync', '-D']),
);
});
}
diff --git a/tools/engine_tool/test/fixtures.dart b/tools/engine_tool/test/fixtures.dart
index 70de4d3..6b11910 100644
--- a/tools/engine_tool/test/fixtures.dart
+++ b/tools/engine_tool/test/fixtures.dart
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-String testConfig(String osDimension, String osPlatform) => '''
+String testConfig(String osDimension, String osPlatform,
+ {String suffix = ''}) =>
+ '''
{
"builds": [
{
"archives": [
{
- "name": "build_name",
+ "name": "build_name$suffix",
"base_path": "base/path",
"type": "gcs",
"include_paths": ["include/path"],
@@ -22,16 +24,16 @@
"variable": false
},
"gn": ["--gn-arg", "--lto", "--no-rbe"],
- "name": "ci/build_name",
+ "name": "ci/build_name$suffix",
"description": "This is a very long description that will test that the help message is wrapped correctly at an appropriate number of characters.",
"ninja": {
- "config": "build_name",
+ "config": "build_name$suffix",
"targets": ["ninja_target"]
},
"tests": [
{
"language": "python3",
- "name": "build_name tests",
+ "name": "build_name$suffix tests",
"parameters": ["--test-params"],
"script": "test/script.py",
"contexts": ["context"]
@@ -55,9 +57,9 @@
"os=$osDimension"
],
"gn": ["--gn-arg", "--lto", "--no-rbe"],
- "name": "$osPlatform/host_debug",
+ "name": "$osPlatform/host_debug$suffix",
"ninja": {
- "config": "host_debug",
+ "config": "host_debug$suffix",
"targets": ["ninja_target"]
}
},
@@ -66,9 +68,9 @@
"os=$osDimension"
],
"gn": ["--gn-arg", "--lto", "--no-rbe"],
- "name": "$osPlatform/android_debug_arm64",
+ "name": "$osPlatform/android_debug${suffix}_arm64",
"ninja": {
- "config": "android_debug_arm64",
+ "config": "android_debug${suffix}_arm64",
"targets": ["ninja_target"]
}
},
@@ -77,9 +79,9 @@
"os=$osDimension"
],
"gn": ["--gn-arg", "--lto", "--rbe"],
- "name": "ci/android_debug_rbe_arm64",
+ "name": "ci/android_debug${suffix}_rbe_arm64",
"ninja": {
- "config": "android_debug_rbe_arm64",
+ "config": "android_debug${suffix}_rbe_arm64",
"targets": ["ninja_target"]
}
}
diff --git a/tools/engine_tool/test/format_command_test.dart b/tools/engine_tool/test/format_command_test.dart
index 3256320..6c7b88a 100644
--- a/tools/engine_tool/test/format_command_test.dart
+++ b/tools/engine_tool/test/format_command_test.dart
@@ -11,11 +11,11 @@
import 'package:engine_tool/src/commands/flags.dart';
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart';
import 'package:logging/logging.dart' as log;
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
void main() {
final Engine engine;
diff --git a/tools/engine_tool/test/gn_test.dart b/tools/engine_tool/test/gn_test.dart
index 8bebbd3..cfa7e16 100644
--- a/tools/engine_tool/test/gn_test.dart
+++ b/tools/engine_tool/test/gn_test.dart
@@ -4,7 +4,7 @@
import 'package:engine_tool/src/gn.dart';
import 'package:engine_tool/src/label.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
import 'utils.dart';
diff --git a/tools/engine_tool/test/label_test.dart b/tools/engine_tool/test/label_test.dart
index b12cf51..0e40114 100644
--- a/tools/engine_tool/test/label_test.dart
+++ b/tools/engine_tool/test/label_test.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:engine_tool/src/label.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
void main() {
group('Label', () {
diff --git a/tools/engine_tool/test/lint_command_test.dart b/tools/engine_tool/test/lint_command_test.dart
index 9f1a783..2d6eb69 100644
--- a/tools/engine_tool/test/lint_command_test.dart
+++ b/tools/engine_tool/test/lint_command_test.dart
@@ -11,10 +11,10 @@
import 'package:engine_tool/src/commands/command_runner.dart';
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
@@ -47,7 +47,6 @@
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
'linux_test_config': linuxTestConfig,
- 'linux_test_config2': linuxTestConfig,
'mac_test_config': macTestConfig,
'win_test_config': winTestConfig,
};
diff --git a/tools/engine_tool/test/logger_test.dart b/tools/engine_tool/test/logger_test.dart
index 1deea42..ddbf927 100644
--- a/tools/engine_tool/test/logger_test.dart
+++ b/tools/engine_tool/test/logger_test.dart
@@ -3,8 +3,8 @@
// found in the LICENSE file.
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart';
import 'package:logging/logging.dart' as log;
+import 'package:test/test.dart';
void main() {
List<String> stringsFromLogs(List<log.LogRecord> logs) {
diff --git a/tools/engine_tool/test/phone_home_test.dart b/tools/engine_tool/test/phone_home_test.dart
index d861de6..8a29041 100644
--- a/tools/engine_tool/test/phone_home_test.dart
+++ b/tools/engine_tool/test/phone_home_test.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:engine_tool/src/phone_home.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
void main() {
test('can et phone home', () async {
diff --git a/tools/engine_tool/test/proc_utils_test.dart b/tools/engine_tool/test/proc_utils_test.dart
index 8f32dac..946fbaf 100644
--- a/tools/engine_tool/test/proc_utils_test.dart
+++ b/tools/engine_tool/test/proc_utils_test.dart
@@ -10,10 +10,10 @@
import 'package:engine_tool/src/logger.dart';
import 'package:engine_tool/src/proc_utils.dart';
import 'package:engine_tool/src/worker_pool.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
void main() {
final Engine engine;
@@ -79,7 +79,7 @@
ProcessTask('F', env, io.Directory.current, <String>['failure']);
final bool r = await wp.run(<WorkerTask>{task});
expect(r, equals(false));
- expect(task.processArtifacts.exitCode, notEquals(0));
+ expect(task.processArtifacts.exitCode, isNot(0));
final ProcessArtifacts loaded =
ProcessArtifacts.fromFile(io.File(task.processArtifactsPath));
expect(loaded.stdout, equals('stdout failure'));
diff --git a/tools/engine_tool/test/query_command_test.dart b/tools/engine_tool/test/query_command_test.dart
index c4c762d..aef5664 100644
--- a/tools/engine_tool/test/query_command_test.dart
+++ b/tools/engine_tool/test/query_command_test.dart
@@ -7,9 +7,9 @@
import 'package:engine_build_configs/engine_build_configs.dart';
import 'package:engine_tool/src/commands/command_runner.dart';
import 'package:engine_tool/src/environment.dart';
-import 'package:litetest/litetest.dart';
import 'package:logging/logging.dart' as log;
import 'package:platform/platform.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
import 'utils.dart';
@@ -21,6 +21,12 @@
as Map<String, Object?>,
);
+ final BuilderConfig linuxTestConfig2 = BuilderConfig.fromJson(
+ path: 'ci/builders/linux_test_config2.json',
+ map: convert.jsonDecode(fixtures.testConfig('Linux', Platform.linux, suffix: '2'))
+ as Map<String, Object?>,
+ );
+
final BuilderConfig macTestConfig = BuilderConfig.fromJson(
path: 'ci/builders/mac_test_config.json',
map: convert.jsonDecode(fixtures.testConfig('Mac-12', Platform.macOS))
@@ -35,7 +41,7 @@
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
'linux_test_config': linuxTestConfig,
- 'linux_test_config2': linuxTestConfig,
+ 'linux_test_config2': linuxTestConfig2,
'mac_test_config': macTestConfig,
'win_test_config': winTestConfig,
};
@@ -75,10 +81,10 @@
' "linux/android_debug_arm64" config\n',
' "ci/android_debug_rbe_arm64" config\n',
'"linux_test_config2" builder:\n',
- ' "ci/build_name" config\n',
- ' "linux/host_debug" config\n',
- ' "linux/android_debug_arm64" config\n',
- ' "ci/android_debug_rbe_arm64" config\n',
+ ' "ci/build_name2" config\n',
+ ' "linux/host_debug2" config\n',
+ ' "linux/android_debug2_arm64" config\n',
+ ' "ci/android_debug2_rbe_arm64" config\n',
]),
);
} finally {
diff --git a/tools/engine_tool/test/run_command_test.dart b/tools/engine_tool/test/run_command_test.dart
index 494a382..1bf2d30 100644
--- a/tools/engine_tool/test/run_command_test.dart
+++ b/tools/engine_tool/test/run_command_test.dart
@@ -13,10 +13,10 @@
import 'package:engine_tool/src/label.dart';
import 'package:engine_tool/src/logger.dart';
import 'package:engine_tool/src/run_utils.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
@@ -50,7 +50,6 @@
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
'linux_test_config': linuxTestConfig,
- 'linux_test_config2': linuxTestConfig,
'mac_test_config': macTestConfig,
'win_test_config': winTestConfig,
};
@@ -62,10 +61,10 @@
abi: ffi.Abi.linuxX64,
engine: engine,
platform: FakePlatform(
- operatingSystem: Platform.linux,
- resolvedExecutable: io.Platform.resolvedExecutable,
- pathSeparator: '/',
- numberOfProcessors: 32,
+ operatingSystem: Platform.linux,
+ resolvedExecutable: io.Platform.resolvedExecutable,
+ pathSeparator: '/',
+ numberOfProcessors: 32,
),
processRunner: ProcessRunner(
processManager: FakeProcessManager(onStart: (List<String> command) {
@@ -100,7 +99,7 @@
expect(result, equals(0));
expect(runHistory.length, greaterThanOrEqualTo(6));
expect(runHistory[5],
- containsStringsInOrder(<String>['flutter', 'run', '--weird_argument']));
+ containsAllInOrder(<String>['flutter', 'run', '--weird_argument']));
});
test('parse devices list', () async {
@@ -165,7 +164,7 @@
// Observe that we selected android_debug_arm64 as the target.
expect(
runHistory[5],
- containsStringsInOrder(<String>[
+ containsAllInOrder(<String>[
'flutter',
'run',
'--local-engine',
diff --git a/tools/engine_tool/test/test_command_test.dart b/tools/engine_tool/test/test_command_test.dart
index dfb640d..792ecfb 100644
--- a/tools/engine_tool/test/test_command_test.dart
+++ b/tools/engine_tool/test/test_command_test.dart
@@ -7,8 +7,8 @@
import 'package:engine_build_configs/engine_build_configs.dart';
import 'package:engine_tool/src/commands/command_runner.dart';
import 'package:engine_tool/src/environment.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
import 'utils.dart';
@@ -34,7 +34,6 @@
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
'linux_test_config': linuxTestConfig,
- 'linux_test_config2': linuxTestConfig,
'mac_test_config': macTestConfig,
'win_test_config': winTestConfig,
};
diff --git a/tools/engine_tool/test/typed_json_test.dart b/tools/engine_tool/test/typed_json_test.dart
index c23df2b..ca2d2c9 100644
--- a/tools/engine_tool/test/typed_json_test.dart
+++ b/tools/engine_tool/test/typed_json_test.dart
@@ -3,23 +3,27 @@
// found in the LICENSE file.
import 'package:engine_tool/src/typed_json.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
void main() {
group('JsonObject.string', () {
test('returns string value', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
expect(jsonObject.string('key'), 'value');
});
test('throws due to missing key', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.string('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.string('missing'),
+ throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
});
test('throws due to wrong type', () {
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
- expect(() => jsonObject.string('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ expect(() => jsonObject.string('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
@@ -31,12 +35,15 @@
test('throws due to missing key', () {
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
- expect(() => jsonObject.integer('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
+ expect(() => jsonObject.integer('missing'),
+ throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.integer('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.integer('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
@@ -48,51 +55,67 @@
test('throws due to missing key', () {
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': true});
- expect(() => jsonObject.boolean('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
+ expect(() => jsonObject.boolean('missing'),
+ throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.boolean('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.boolean('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
group('JsonObject.stringList', () {
test('returns string list value', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 'value2']
+ });
expect(jsonObject.stringList('key'), <String>['value1', 'value2']);
});
test('throws due to missing key', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
- expect(() => jsonObject.stringList('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 'value2']
+ });
+ expect(() => jsonObject.stringList('missing'),
+ throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.stringList('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.stringList('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
test('throws due to wrong element type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 42]});
- expect(() => jsonObject.stringList('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 42]
+ });
+ expect(() => jsonObject.stringList('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
group('JsonObject.stringOrNull', () {
test('returns string value', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
expect(jsonObject.stringOrNull('key'), 'value');
});
test('returns null due to missing key', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
expect(jsonObject.stringOrNull('missing'), isNull);
});
test('throws due to wrong type', () {
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
- expect(() => jsonObject.stringOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ expect(() => jsonObject.stringOrNull('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
@@ -108,8 +131,10 @@
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.integerOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.integerOrNull('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
@@ -125,36 +150,48 @@
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.booleanOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.booleanOrNull('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
group('JsonObject.stringListOrNull', () {
test('returns string list value', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 'value2']
+ });
expect(jsonObject.stringListOrNull('key'), <String>['value1', 'value2']);
});
test('returns null due to missing key', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 'value2']
+ });
expect(jsonObject.stringListOrNull('missing'), isNull);
});
test('throws due to wrong type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
- expect(() => jsonObject.stringListOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject =
+ JsonObject(<String, Object?>{'key': 'value'});
+ expect(() => jsonObject.stringListOrNull('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
test('throws due to wrong element type', () {
- const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 42]});
- expect(() => jsonObject.stringListOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
+ const JsonObject jsonObject = JsonObject(<String, Object?>{
+ 'key': <Object?>['value1', 42]
+ });
+ expect(() => jsonObject.stringListOrNull('key'),
+ throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
});
});
group('JsonObject.map', () {
test('returns multiple fields', () {
- final (String name, int age, bool isStudent) = const JsonObject(<String, Object?>{
+ final (String name, int age, bool isStudent) =
+ const JsonObject(<String, Object?>{
'name': 'Alice',
'age': 42,
'isStudent': true,
@@ -185,9 +222,13 @@
fail('Expected JsonMapException');
} on JsonMapException catch (e) {
expect(
- e.exceptions.map((JsonReadException e) => (e as MissingKeyJsonReadException).key).toList(),
- containsStringsInOrder(<String>['name', 'isStudent'],
- ));
+ e.exceptions
+ .map((JsonReadException e) =>
+ (e as MissingKeyJsonReadException).key)
+ .toList(),
+ containsAllInOrder(
+ <String>['name', 'isStudent'],
+ ));
}
});
@@ -207,18 +248,22 @@
fail('Expected JsonMapException');
} on JsonMapException catch (e) {
expect(
- e.exceptions.map((JsonReadException e) => switch (e) {
- final InvalidTypeJsonReadException e => e.key,
- final MissingKeyJsonReadException e => e.key,
- _ => throw StateError('Unexpected exception type: $e'),
- }).toList(),
- containsStringsInOrder(<String>['name', 'age'],
- ));
+ e.exceptions
+ .map((JsonReadException e) => switch (e) {
+ final InvalidTypeJsonReadException e => e.key,
+ final MissingKeyJsonReadException e => e.key,
+ _ => throw StateError('Unexpected exception type: $e'),
+ })
+ .toList(),
+ containsAllInOrder(
+ <String>['name', 'age'],
+ ));
}
});
test('allows a default with onError', () {
- final (String name, int age, bool isStudent) = const JsonObject(<String, Object?>{
+ final (String name, int age, bool isStudent) =
+ const JsonObject(<String, Object?>{
'name': 'Alice',
'age': 42,
'isStudent': 'true',
@@ -230,11 +275,13 @@
);
}, onError: expectAsync2((_, JsonMapException e) {
expect(
- e.exceptions.map((JsonReadException e) => switch (e) {
- final InvalidTypeJsonReadException e => e.key,
- final MissingKeyJsonReadException e => e.key,
- _ => throw StateError('Unexpected exception type: $e'),
- }).toList(),
+ e.exceptions
+ .map((JsonReadException e) => switch (e) {
+ final InvalidTypeJsonReadException e => e.key,
+ final MissingKeyJsonReadException e => e.key,
+ _ => throw StateError('Unexpected exception type: $e'),
+ })
+ .toList(),
<String>['isStudent'],
);
return ('Bob', 0, false);
@@ -258,7 +305,7 @@
json.boolean('isStudent'),
);
});
- }, throwsA(isInstanceOf<ArgumentError>()));
+ }, throwsA(const isInstanceOf<ArgumentError>()));
});
});
}
diff --git a/tools/engine_tool/test/utils.dart b/tools/engine_tool/test/utils.dart
index f9f94ba..6cc07e3 100644
--- a/tools/engine_tool/test/utils.dart
+++ b/tools/engine_tool/test/utils.dart
@@ -8,11 +8,11 @@
import 'package:engine_repo_tools/engine_repo_tools.dart';
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
-import 'package:litetest/litetest.dart' show Expect, Matcher;
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
/// Each CannedProcess has a command matcher and the result of an executed
/// process. The matcher is used to determine when to use a registered
@@ -211,48 +211,18 @@
return io.ProcessResult(0, 0, '', '');
}
-typedef CommandMatcher = bool Function(List<String> command);
+Matcher containsCommand(bool Function(List<String> command) matcher) {
+ return predicate((List<ExecutedProcess> history) {
+ return history.any((ExecutedProcess process) {
+ return matcher(process.command);
+ });
+ }, 'contains command');
+}
-/// Returns a [Matcher] that fails the test if no process has a matching command.
-///
-/// Usage:
-/// expect(testEnv.processHistory,
-/// containsCommand((List<String> command) {
-/// return command.length > 5 &&
-/// command[0].contains('ninja') &&
-/// command[2].endsWith('/host_debug') &&
-/// command[5] == 'flutter/fml:fml_arc_unittests';
-/// })
-/// );
-Matcher containsCommand(CommandMatcher commandMatcher) => (dynamic processes) {
- Expect.type<List<ExecutedProcess>>(processes);
- final List<List<String>> commands = (processes as List<ExecutedProcess>)
- .map((ExecutedProcess process) => process.command)
- .toList();
- if (!commands.any(commandMatcher)) {
- Expect.fail('No process found with matching command');
- }
- };
-
-/// Returns a [Matcher] that fails the test if any process has a matching
-/// command.
-///
-/// Usage:
-/// expect(testEnv.processHistory,
-/// doesNotContainCommand((List<String> command) {
-/// return command.length > 5 &&
-/// command[0].contains('ninja') &&
-/// command[2].endsWith('/host_debug') &&
-/// command[5] == 'flutter/fml:fml_arc_unittests';
-/// })
-/// );
-Matcher doesNotContainCommand(CommandMatcher commandMatcher) =>
- (dynamic processes) {
- Expect.type<List<ExecutedProcess>>(processes);
- final List<List<String>> commands = (processes as List<ExecutedProcess>)
- .map((ExecutedProcess process) => process.command)
- .toList();
- if (commands.any(commandMatcher)) {
- Expect.fail('Process found with matching command');
- }
- };
+Matcher doesNotContainCommand(bool Function(List<String> command) matcher) {
+ return predicate((List<ExecutedProcess> history) {
+ return !history.any((ExecutedProcess process) {
+ return matcher(process.command);
+ });
+ }, 'does not contain command');
+}
diff --git a/tools/engine_tool/test/utils_test.dart b/tools/engine_tool/test/utils_test.dart
index 1ce186c..e376f79 100644
--- a/tools/engine_tool/test/utils_test.dart
+++ b/tools/engine_tool/test/utils_test.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
import 'utils.dart';
diff --git a/tools/engine_tool/test/worker_pool_test.dart b/tools/engine_tool/test/worker_pool_test.dart
index 1975283..6e3e615 100644
--- a/tools/engine_tool/test/worker_pool_test.dart
+++ b/tools/engine_tool/test/worker_pool_test.dart
@@ -9,10 +9,10 @@
import 'package:engine_tool/src/environment.dart';
import 'package:engine_tool/src/logger.dart';
import 'package:engine_tool/src/worker_pool.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
class TestWorkerPoolProgressReporter implements WorkerPoolProgressReporter {
int _successCount = 0;
diff --git a/tools/githooks/pubspec.yaml b/tools/githooks/pubspec.yaml
index d16ff21..f0c37a7 100644
--- a/tools/githooks/pubspec.yaml
+++ b/tools/githooks/pubspec.yaml
@@ -19,7 +19,4 @@
path: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
- smith: any
+ test: any
diff --git a/tools/githooks/test/githooks_test.dart b/tools/githooks/test/githooks_test.dart
index 74639c2..d9e56b7 100644
--- a/tools/githooks/test/githooks_test.dart
+++ b/tools/githooks/test/githooks_test.dart
@@ -5,7 +5,7 @@
import 'dart:io' as io;
import 'package:githooks/githooks.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
void main() {
test('Fails gracefully without a command', () async {
diff --git a/tools/licenses/pubspec.yaml b/tools/licenses/pubspec.yaml
index 5c5a656..caa66d7 100644
--- a/tools/licenses/pubspec.yaml
+++ b/tools/licenses/pubspec.yaml
@@ -21,4 +21,4 @@
path: any
dev_dependencies:
- litetest: any
+ test: any
diff --git a/tools/licenses/test/formatter_test.dart b/tools/licenses/test/formatter_test.dart
index 39c4d86..565763d 100644
--- a/tools/licenses/test/formatter_test.dart
+++ b/tools/licenses/test/formatter_test.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:licenses/formatter.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
void main() {
test('Block comments', () {
diff --git a/tools/pkg/engine_build_configs/pubspec.yaml b/tools/pkg/engine_build_configs/pubspec.yaml
index 2af0e6c..369800c 100644
--- a/tools/pkg/engine_build_configs/pubspec.yaml
+++ b/tools/pkg/engine_build_configs/pubspec.yaml
@@ -23,9 +23,6 @@
yaml: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
process_fakes: any
- smith: any
source_span: any
+ test: any
diff --git a/tools/pkg/engine_build_configs/test/build_config_loader_test.dart b/tools/pkg/engine_build_configs/test/build_config_loader_test.dart
index d0ba235..27ab0dc 100644
--- a/tools/pkg/engine_build_configs/test/build_config_loader_test.dart
+++ b/tools/pkg/engine_build_configs/test/build_config_loader_test.dart
@@ -6,7 +6,7 @@
import 'package:engine_build_configs/src/build_config_loader.dart';
import 'package:file/file.dart';
import 'package:file/memory.dart';
-import 'package:litetest/litetest.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
diff --git a/tools/pkg/engine_build_configs/test/build_config_runner_test.dart b/tools/pkg/engine_build_configs/test/build_config_runner_test.dart
index 5304684..b98474d 100644
--- a/tools/pkg/engine_build_configs/test/build_config_runner_test.dart
+++ b/tools/pkg/engine_build_configs/test/build_config_runner_test.dart
@@ -9,11 +9,11 @@
import 'package:engine_build_configs/src/build_config.dart';
import 'package:engine_build_configs/src/build_config_runner.dart';
import 'package:engine_repo_tools/engine_repo_tools.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
import 'package:platform/platform.dart';
import 'package:process_fakes/process_fakes.dart';
import 'package:process_runner/process_runner.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
diff --git a/tools/pkg/engine_build_configs/test/build_config_test.dart b/tools/pkg/engine_build_configs/test/build_config_test.dart
index 5bffa83..98df7aa 100644
--- a/tools/pkg/engine_build_configs/test/build_config_test.dart
+++ b/tools/pkg/engine_build_configs/test/build_config_test.dart
@@ -5,8 +5,8 @@
import 'dart:convert' as convert;
import 'package:engine_build_configs/src/build_config.dart';
-import 'package:litetest/litetest.dart';
import 'package:platform/platform.dart';
+import 'package:test/test.dart';
import 'fixtures.dart' as fixtures;
diff --git a/tools/pkg/engine_build_configs/test/ci_yaml_test.dart b/tools/pkg/engine_build_configs/test/ci_yaml_test.dart
index df5e448..0286534 100644
--- a/tools/pkg/engine_build_configs/test/ci_yaml_test.dart
+++ b/tools/pkg/engine_build_configs/test/ci_yaml_test.dart
@@ -6,9 +6,9 @@
import 'package:engine_build_configs/src/ci_yaml.dart';
import 'package:engine_repo_tools/engine_repo_tools.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as path;
import 'package:source_span/source_span.dart';
+import 'package:test/test.dart';
import 'package:yaml/yaml.dart' as y;
void main() {
diff --git a/tools/pkg/engine_repo_tools/pubspec.yaml b/tools/pkg/engine_repo_tools/pubspec.yaml
index 652f147..02c8262 100644
--- a/tools/pkg/engine_repo_tools/pubspec.yaml
+++ b/tools/pkg/engine_repo_tools/pubspec.yaml
@@ -17,7 +17,4 @@
path: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
- smith: any
+ test: any
diff --git a/tools/pkg/engine_repo_tools/test/engine_repo_tools_test.dart b/tools/pkg/engine_repo_tools/test/engine_repo_tools_test.dart
index 4b6a05b..f0ccb14 100644
--- a/tools/pkg/engine_repo_tools/test/engine_repo_tools_test.dart
+++ b/tools/pkg/engine_repo_tools/test/engine_repo_tools_test.dart
@@ -3,10 +3,10 @@
// found in the LICENSE file.
import 'dart:io' as io;
-import 'package:async_helper/async_helper.dart';
+
import 'package:engine_repo_tools/engine_repo_tools.dart';
-import 'package:litetest/litetest.dart';
import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
void main() {
late io.Directory emptyDir;
@@ -25,9 +25,9 @@
setUp();
try {
expect(
- () => Engine.fromSrcPath(emptyDir.path),
- _throwsInvalidEngineException,
- );
+ () => Engine.fromSrcPath(emptyDir.path),
+ throwsA(const TypeMatcher<InvalidEngineException>()),
+ );
} finally {
tearDown();
}
@@ -38,7 +38,7 @@
try {
expect(
() => Engine.fromSrcPath(p.join(emptyDir.path, 'src')),
- _throwsInvalidEngineException,
+ throwsA(const TypeMatcher<InvalidEngineException>()),
);
} finally {
tearDown();
@@ -51,7 +51,7 @@
final io.Directory srcDir = io.Directory(p.join(emptyDir.path, 'src'))..createSync();
expect(
() => Engine.fromSrcPath(srcDir.path),
- _throwsInvalidEngineException,
+ throwsA(const TypeMatcher<InvalidEngineException>()),
);
} finally {
tearDown();
@@ -241,33 +241,3 @@
}
});
}
-
-// This is needed because async_minitest and friends is not a proper testing
-// library and is missing a lot of functionality that was exclusively added
-// to pkg/test.
-void _throwsInvalidEngineException(Object? o) {
- _checkThrow<InvalidEngineException>(o, (_){});
-}
-
-// Mostly copied from async_minitest.
-void _checkThrow<T extends Object>(dynamic v, void Function(dynamic error) onError) {
- if (v is Future) {
- asyncStart();
- v.then((_) {
- Expect.fail('Did not throw');
- }, onError: (Object e, StackTrace s) {
- if (e is! T) {
- // ignore: only_throw_errors
- throw e;
- }
- onError(e);
- asyncEnd();
- });
- return;
- }
- v as void Function();
- Expect.throws<T>(v, (T e) {
- onError(e);
- return true;
- });
-}
diff --git a/tools/pkg/git_repo_tools/pubspec.yaml b/tools/pkg/git_repo_tools/pubspec.yaml
index db6a697..e01df70 100644
--- a/tools/pkg/git_repo_tools/pubspec.yaml
+++ b/tools/pkg/git_repo_tools/pubspec.yaml
@@ -19,8 +19,5 @@
process_runner: any
dev_dependencies:
- async_helper: any
- expect: any
- litetest: any
process_fakes: any
- smith: any
+ test: any
diff --git a/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart b/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart
index c404817..7fe38ef 100644
--- a/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart
+++ b/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart
@@ -5,13 +5,12 @@
import 'dart:io' as io;
import 'package:git_repo_tools/git_repo_tools.dart';
-import 'package:litetest/litetest.dart';
import 'package:process_fakes/process_fakes.dart';
+import 'package:test/test.dart';
void main() {
const String fakeShaHash = 'fake-sha-hash';
-
test('returns non-deleted files which differ from merge-base with main', () async {
final Fixture fixture = Fixture(
processManager: FakeProcessManager(