From 2865df0d24fc1fd8713c7556a70ba9a32c4c589c Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Thu, 15 Aug 2024 14:39:55 -0700 Subject: [PATCH 1/3] chore(bump): checks package --- actions/pubspec.yaml | 2 +- packages/aft/pubspec.yaml | 2 +- packages/aft/test/config/config_loader_test.dart | 6 +++--- 3 files changed, 5 insertions(+), 5 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/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'), ); From 79b47867ffc3f010bbad9aef468f3e6ae4e9dc0c Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Thu, 15 Aug 2024 14:46:36 -0700 Subject: [PATCH 2/3] chore: fixed deprecated it() utility --- actions/test/node/interop_test.dart | 16 ++++++++-------- actions/test/node/process_manager_test.dart | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/actions/test/node/interop_test.dart b/actions/test/node/interop_test.dart index 7c4f3c93dd..7f6b76f566 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'), ); @@ -56,9 +56,9 @@ void main() { unawaited( check(proc.stdout!.stream).withQueue.inOrder([ // ignore: unawaited_futures - it()..emits(it()..deepEquals(utf8.encode('Hello\n'))), + (it) => it..emits((it) => it..deepEquals(utf8.encode('Hello\n'))), // ignore: unawaited_futures - it()..isDone(), + (it) => it..isDone(), ]), ); unawaited( @@ -66,7 +66,7 @@ void main() { ); 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(); @@ -82,13 +82,13 @@ void main() { ); unawaited( check(proc.stdout!.stream).withQueue.inOrder([ - it() + (it) => it // ignore: unawaited_futures ..emits( - it()..deepEquals(utf8.encode('Hello\n')), + (it) => it..deepEquals(utf8.encode('Hello\n')), ), // ignore: unawaited_futures - it()..isDone(), + (it) => it..isDone(), ]), ); unawaited( @@ -96,7 +96,7 @@ void main() { ); 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..aed7358584 100644 --- a/actions/test/node/process_manager_test.dart +++ b/actions/test/node/process_manager_test.dart @@ -29,7 +29,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 +38,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'), ); @@ -58,16 +58,16 @@ void main() { if (mode != ProcessStartMode.inheritStdio && mode != ProcessStartMode.detached) // ignore: unawaited_futures - it()..emits(it()..deepEquals(expectedOutput)), + (it) => it..emits((it) => it..deepEquals(expectedOutput)), // ignore: unawaited_futures - it()..isDone(), + (it) => it..isDone(), ]), ); 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)); }); } @@ -76,15 +76,15 @@ void main() { final proc = await processManager.start(['tee'], pipe: echo); unawaited( check(proc.stdout).withQueue.inOrder([ - it() + (it) => it // ignore: unawaited_futures - ..emits(it()..deepEquals(utf8.encode('Hello\n'))), + ..emits((it) => it..deepEquals(utf8.encode('Hello\n'))), // ignore: unawaited_futures - it()..isDone(), + (it) => it..isDone(), ]), ); unawaited(check(proc.stderr).withQueue.isDone()); - await check(proc.exitCode).completes(it()..equals(0)); + await check(proc.exitCode).completes((it) => it..equals(0)); }); }); }); From c91d7749968a94bb0e71f71a8b05cc3ad46d1b5f Mon Sep 17 00:00:00 2001 From: Tyler-Larkin Date: Fri, 16 Aug 2024 08:47:58 -0700 Subject: [PATCH 3/3] chore: fixed checks unit tests --- actions/test/node/interop_test.dart | 29 +++++++++--------- actions/test/node/process_manager_test.dart | 33 ++++++++++----------- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/actions/test/node/interop_test.dart b/actions/test/node/interop_test.dart index 7f6b76f566..6b385aec3b 100644 --- a/actions/test/node/interop_test.dart +++ b/actions/test/node/interop_test.dart @@ -54,12 +54,13 @@ void main() { test('spawn', () async { final proc = childProcess.spawn('echo', ['Hello']); unawaited( - check(proc.stdout!.stream).withQueue.inOrder([ - // ignore: unawaited_futures - (it) => it..emits((it) => it..deepEquals(utf8.encode('Hello\n'))), - // ignore: unawaited_futures - (it) => it..isDone(), - ]), + expectLater( + proc.stdout!.stream.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited( check(proc.stderr!.stream).withQueue.isDone(), @@ -81,15 +82,13 @@ void main() { stdin: echo.stdout, ); unawaited( - check(proc.stdout!.stream).withQueue.inOrder([ - (it) => it - // ignore: unawaited_futures - ..emits( - (it) => it..deepEquals(utf8.encode('Hello\n')), - ), - // ignore: unawaited_futures - (it) => it..isDone(), - ]), + expectLater( + proc.stdout!.stream.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited( check(proc.stderr!.stream).withQueue.isDone(), diff --git a/actions/test/node/process_manager_test.dart b/actions/test/node/process_manager_test.dart index aed7358584..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'; @@ -52,16 +51,16 @@ 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) => it..emits((it) => it..deepEquals(expectedOutput)), - // ignore: unawaited_futures - (it) => 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(), @@ -75,13 +74,13 @@ void main() { final echo = childProcess.spawn('echo', ['Hello']); final proc = await processManager.start(['tee'], pipe: echo); unawaited( - check(proc.stdout).withQueue.inOrder([ - (it) => it - // ignore: unawaited_futures - ..emits((it) => it..deepEquals(utf8.encode('Hello\n'))), - // ignore: unawaited_futures - (it) => it..isDone(), - ]), + expectLater( + proc.stdout.map(String.fromCharCodes), + emitsInOrder([ + 'Hello\n', + emitsDone, + ]), + ), ); unawaited(check(proc.stderr).withQueue.isDone()); await check(proc.exitCode).completes((it) => it..equals(0));