From a8a015fdd456d58bae1eff6fcd1aa610fd67be56 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Mon, 28 Oct 2024 14:32:03 -0500 Subject: [PATCH 1/2] feat(shorebird_cli): `shorebird preview` outputs apks path --- .../shorebird_cli/lib/src/commands/preview_command.dart | 3 ++- .../test/src/commands/preview_command_test.dart | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/shorebird_cli/lib/src/commands/preview_command.dart b/packages/shorebird_cli/lib/src/commands/preview_command.dart index b2ad969c5..4cfaa045c 100644 --- a/packages/shorebird_cli/lib/src/commands/preview_command.dart +++ b/packages/shorebird_cli/lib/src/commands/preview_command.dart @@ -361,7 +361,8 @@ class PreviewCommand extends ShorebirdCommand { final buildApksProgress = logger.progress('Building apks'); try { await bundletool.buildApks(bundle: aabFile.path, output: apksPath); - buildApksProgress.complete(); + final apksLink = link(uri: Uri.parse(apksPath)); + buildApksProgress.complete('Built apks: ${cyan.wrap(apksLink)}'); } catch (error) { buildApksProgress.fail('$error'); return ExitCode.software.code; diff --git a/packages/shorebird_cli/test/src/commands/preview_command_test.dart b/packages/shorebird_cli/test/src/commands/preview_command_test.dart index ff815683d..2fe889c5b 100644 --- a/packages/shorebird_cli/test/src/commands/preview_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/preview_command_test.dart @@ -443,6 +443,14 @@ void main() { }); }); + test('outputs apks path', () async { + await runWithOverrides(command.run); + + verify( + () => progress.complete(any(that: contains(apksPath()))), + ).called(1); + }); + test('does not prompt for platform, uses android', () async { await runWithOverrides(command.run); From be6171c97de28df622bf142dacfe4fc7c3c52c6d Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Mon, 28 Oct 2024 14:39:30 -0500 Subject: [PATCH 2/2] make test more strict --- .../shorebird_cli/test/src/commands/preview_command_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shorebird_cli/test/src/commands/preview_command_test.dart b/packages/shorebird_cli/test/src/commands/preview_command_test.dart index 2fe889c5b..7aea9ca25 100644 --- a/packages/shorebird_cli/test/src/commands/preview_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/preview_command_test.dart @@ -445,9 +445,9 @@ void main() { test('outputs apks path', () async { await runWithOverrides(command.run); - + final apksLink = link(uri: Uri.parse(apksPath())); verify( - () => progress.complete(any(that: contains(apksPath()))), + () => progress.complete('Built apks: ${cyan.wrap(apksLink)}'), ).called(1); });