From 060eebabcb25f10c86407ad85ec6636b7e4917b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Fri, 16 Jun 2023 09:55:57 +0200 Subject: [PATCH] Reintroduce tvOS as valid simulator version when matching for simulators (#1929) (#1969) * reintroduce tvOS as valid target when matching simulators * reintroduce matching of Apple TV devices test Co-authored-by: Marcin Grzywaczewski --- .../__tests__/findMatchingSimulator.test.ts | 37 +++++++++++++++++++ .../src/tools/findMatchingSimulator.ts | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/packages/cli-platform-ios/src/tools/__tests__/findMatchingSimulator.test.ts b/packages/cli-platform-ios/src/tools/__tests__/findMatchingSimulator.test.ts index e70919b1f..73ac2cb03 100644 --- a/packages/cli-platform-ios/src/tools/__tests__/findMatchingSimulator.test.ts +++ b/packages/cli-platform-ios/src/tools/__tests__/findMatchingSimulator.test.ts @@ -1027,4 +1027,41 @@ describe('findMatchingSimulator', () => { version: 'iOS 16.0', }); }); + + it('should return AppleTV devices if in the list', () => { + expect( + findMatchingSimulator( + { + devices: { + 'com.apple.CoreSimulator.SimRuntime.tvOS-11-2': [ + { + state: 'Booted', + availability: '(available)', + name: 'Apple TV', + udid: '816C30EA-38EA-41AC-BFDA-96FB632D522E', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'Apple TV 4K', + udid: 'BCBB7E4B-D872-4D61-BC61-7C9805551075', + }, + { + state: 'Shutdown', + availability: '(available)', + name: 'Apple TV 4K (at 1080p)', + udid: '1DE12308-1C14-4F0F-991E-A3ADC41BDFFC', + }, + ], + }, + }, + {simulator: 'Apple TV'}, + ), + ).toEqual({ + udid: '816C30EA-38EA-41AC-BFDA-96FB632D522E', + name: 'Apple TV', + booted: true, + version: 'tvOS 11.2', + }); + }); }); diff --git a/packages/cli-platform-ios/src/tools/findMatchingSimulator.ts b/packages/cli-platform-ios/src/tools/findMatchingSimulator.ts index 9f2d1e795..e0a51a662 100644 --- a/packages/cli-platform-ios/src/tools/findMatchingSimulator.ts +++ b/packages/cli-platform-ios/src/tools/findMatchingSimulator.ts @@ -66,7 +66,7 @@ function findMatchingSimulator( } // Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc) - if (!version.includes('iOS')) { + if (!version.includes('iOS') && !version.includes('tvOS')) { continue; } if (simulatorVersion && !version.endsWith(simulatorVersion)) {