From 05bf4663eeda2ddd5e20fddda1e3abb1a1f747ab Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Fri, 16 Aug 2024 09:31:27 -0700 Subject: [PATCH] chore(bump): checks package (#5305) * chore(bump): checks package --- actions/pubspec.yaml | 2 +- actions/test/node/interop_test.dart | 35 ++++++++-------- actions/test/node/process_manager_test.dart | 41 +++++++++---------- packages/aft/pubspec.yaml | 2 +- .../aft/test/config/config_loader_test.dart | 6 +-- 5 files changed, 42 insertions(+), 44 deletions(-) diff --git a/actions/pubspec.yaml b/actions/pubspec.yaml index 56cba3a72f..f4b560a372 100644 --- a/actions/pubspec.yaml +++ b/actions/pubspec.yaml @@ -23,7 +23,7 @@ dev_dependencies: amplify_lints: ^3.0.0 build_runner: ^2.4.9 build_test: ^2.2.0 - checks: ^0.2.2 + checks: ^0.3.0 json_serializable: 6.8.0 test: ^1.22.1 diff --git a/actions/test/node/interop_test.dart b/actions/test/node/interop_test.dart index 7c4f3c93dd..6b385aec3b 100644 --- a/actions/test/node/interop_test.dart +++ b/actions/test/node/interop_test.dart @@ -45,7 +45,7 @@ void main() { test('exec', () async { await check(childProcess.exec('echo', ['Hello'])).completes( - it() + (it) => it ..has((res) => res.exitCode, 'exitCode').equals(0) ..has((res) => res.stdout, 'stdout').equals('Hello\n'), ); @@ -54,19 +54,20 @@ void main() { test('spawn', () async { final proc = childProcess.spawn('echo', ['Hello']); unawaited( - check(proc.stdout!.stream).withQueue.inOrder([ - // ignore: unawaited_futures - it()..emits(it()..deepEquals(utf8.encode('Hello\n'))), - // ignore: unawaited_futures - it()..isDone(), - ]), + expectLater( + proc.stdout!.stream.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited( check(proc.stderr!.stream).withQueue.isDone(), ); unawaited( check((proc.onClose, proc.onExit).wait).completes( - it()..has((res) => res.$2.toDartInt, 'exitCode').equals(0), + (it) => it..has((res) => res.$2.toDartInt, 'exitCode').equals(0), ), ); await check(proc.onSpawn).completes(); @@ -81,22 +82,20 @@ void main() { stdin: echo.stdout, ); unawaited( - check(proc.stdout!.stream).withQueue.inOrder([ - it() - // ignore: unawaited_futures - ..emits( - it()..deepEquals(utf8.encode('Hello\n')), - ), - // ignore: unawaited_futures - it()..isDone(), - ]), + expectLater( + proc.stdout!.stream.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited( check(proc.stderr!.stream).withQueue.isDone(), ); unawaited( check((proc.onClose, proc.onExit).wait).completes( - it()..has((res) => res.$2.toDartInt, 'exitCode').equals(0), + (it) => it..has((res) => res.$2.toDartInt, 'exitCode').equals(0), ), ); await check(proc.onSpawn).completes(); diff --git a/actions/test/node/process_manager_test.dart b/actions/test/node/process_manager_test.dart index d65207cccc..061c2bd7af 100644 --- a/actions/test/node/process_manager_test.dart +++ b/actions/test/node/process_manager_test.dart @@ -5,7 +5,6 @@ library; import 'dart:async'; -import 'dart:convert'; import 'package:actions/actions.dart'; import 'package:actions/src/node/process_manager.dart'; @@ -29,7 +28,7 @@ void main() { group('run', () { test('echo', () async { await check(processManager.run(['echo', 'Hello'])).completes( - it() + (it) => it ..has((res) => res.exitCode, 'exitCode').equals(0) ..has((res) => res.stdout, 'stdout').equals('Hello\n'), ); @@ -38,7 +37,7 @@ void main() { test('pipe', () async { final echo = childProcess.spawn('echo', ['Hello']); await check(processManager.run(['tee'], pipe: echo)).completes( - it() + (it) => it ..has((res) => res.exitCode, 'exitCode').equals(0) ..has((res) => res.stdout, 'stdout').equals('Hello\n'), ); @@ -52,22 +51,22 @@ void main() { ['echo', 'Hello'], mode: mode, ); - final expectedOutput = utf8.encode('Hello\n'); unawaited( - check(proc.stdout).withQueue.inOrder([ - if (mode != ProcessStartMode.inheritStdio && - mode != ProcessStartMode.detached) - // ignore: unawaited_futures - it()..emits(it()..deepEquals(expectedOutput)), - // ignore: unawaited_futures - it()..isDone(), - ]), + expectLater( + proc.stdout.map(String.fromCharCodes), + emitsInOrder([ + if (mode != ProcessStartMode.inheritStdio && + mode != ProcessStartMode.detached) + 'Hello\n', + emitsDone, + ]), + ), ); unawaited( check(proc.stderr).withQueue.isDone(), ); check(proc.pid).isGreaterThan(0); - await check(proc.exitCode).completes(it()..equals(0)); + await check(proc.exitCode).completes((it) => it..equals(0)); }); } @@ -75,16 +74,16 @@ void main() { final echo = childProcess.spawn('echo', ['Hello']); final proc = await processManager.start(['tee'], pipe: echo); unawaited( - check(proc.stdout).withQueue.inOrder([ - it() - // ignore: unawaited_futures - ..emits(it()..deepEquals(utf8.encode('Hello\n'))), - // ignore: unawaited_futures - it()..isDone(), - ]), + expectLater( + proc.stdout.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited(check(proc.stderr).withQueue.isDone()); - await check(proc.exitCode).completes(it()..equals(0)); + await check(proc.exitCode).completes((it) => it..equals(0)); }); }); }); diff --git a/packages/aft/pubspec.yaml b/packages/aft/pubspec.yaml index ea157757f8..e1198cc79c 100644 --- a/packages/aft/pubspec.yaml +++ b/packages/aft/pubspec.yaml @@ -67,7 +67,7 @@ dev_dependencies: amplify_lints: ">=2.0.2 <2.1.0" build_runner: ^2.4.9 built_value_generator: 8.8.1 - checks: ^0.2.2 + checks: ^0.3.0 json_serializable: 6.8.0 test: ^1.22.1 test_descriptor: ^2.0.1 diff --git a/packages/aft/test/config/config_loader_test.dart b/packages/aft/test/config/config_loader_test.dart index 7c4dcb993d..168fd07164 100644 --- a/packages/aft/test/config/config_loader_test.dart +++ b/packages/aft/test/config/config_loader_test.dart @@ -108,12 +108,12 @@ aft: 'workingDirectory', ).equals(workingDirectory) ..has((config) => config.dependencies.toMap(), 'dependencies').which( - it() + (it) => it ..containsKey('json_serializable') - ..not(it()..containsKey('built_value')), + ..not((it) => it..containsKey('built_value')), ) ..has((config) => config.scripts.toMap(), 'scripts').which( - it() + (it) => it ..containsKey('license') ..containsKey('format'), );