diff --git a/packages/shorebird_cli/lib/src/commands/preview_command.dart b/packages/shorebird_cli/lib/src/commands/preview_command.dart index ddb5c228..7a28dc38 100644 --- a/packages/shorebird_cli/lib/src/commands/preview_command.dart +++ b/packages/shorebird_cli/lib/src/commands/preview_command.dart @@ -304,6 +304,8 @@ class PreviewCommand extends ShorebirdCommand { required DeploymentTrack track, String? deviceId, }) async { + await iosDeploy.installIfNeeded(); + const platform = ReleasePlatform.ios; final runnerDirectory = Directory( getArtifactPath( 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 65684ed9..020a10e7 100644 --- a/packages/shorebird_cli/test/src/commands/preview_command_test.dart +++ b/packages/shorebird_cli/test/src/commands/preview_command_test.dart @@ -976,6 +976,7 @@ channel: ${track.channel} device: any(named: 'device'), ), ).thenAnswer((_) async => ExitCode.success.code); + when(() => iosDeploy.installIfNeeded()).thenAnswer((_) async {}); when( () => iosDeploy.installAndLaunchApp( bundlePath: any(named: 'bundlePath'), @@ -1002,6 +1003,11 @@ channel: ${track.channel} ..createSync(recursive: true) ..writeAsStringSync('app_id: $appId', flush: true); + test('ensures ios-deploy is installed', () async { + await runWithOverrides(command.run); + verify(() => iosDeploy.installIfNeeded()).called(1); + }); + test('exits with code 70 when querying for release artifact fails', () async { final exception = Exception('oops');