Detect Physical iOS device without Xcode

Summary:
This diff adds the support of detecting physical device in Flipper even if the xcode is not installed and there is no cli tool installed.

See the demo.

Reviewed By: timur-valiev

Differential Revision: D26816588

fbshipit-source-id: 5f052998fcbe5c51385222d16df0e1855177b552
This commit is contained in:
Pritesh Nandgaonkar
2021-03-05 11:34:34 -08:00
committed by Facebook GitHub Bot
parent 11879c127b
commit a2d559c8c0
8 changed files with 238 additions and 39 deletions

View File

@@ -14,9 +14,11 @@ import {mocked} from 'ts-jest/utils';
jest.mock('child_process');
const spawn = mocked(childProcess.spawn);
test('uses xcrun with no idb', async () => {
const ib = await makeIOSBridge('');
ib.startLogListener('deadbeef');
test('uses xcrun with no idb when xcode is detected', async () => {
const ib = await makeIOSBridge('', true);
expect(ib.startLogListener).toBeDefined();
ib.startLogListener!('deadbeef');
expect(spawn).toHaveBeenCalledWith(
'xcrun',
@@ -37,9 +39,11 @@ test('uses xcrun with no idb', async () => {
);
});
test('uses idb when present', async () => {
const ib = await makeIOSBridge('/usr/local/bin/idb', async (_) => true);
ib.startLogListener('deadbeef');
test('uses idb when present and xcode detected', async () => {
const ib = await makeIOSBridge('/usr/local/bin/idb', true, async (_) => true);
expect(ib.startLogListener).toBeDefined();
ib.startLogListener!('deadbeef');
expect(spawn).toHaveBeenCalledWith(
'/usr/local/bin/idb',
@@ -58,3 +62,8 @@ test('uses idb when present', async () => {
{},
);
});
test('uses no log listener when xcode is not detected', async () => {
const ib = await makeIOSBridge('', false);
expect(ib.startLogListener).toBeUndefined();
});