Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace instruments using xctrace #698

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions lib/targets/ios/tasks/list-devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ const deserializeDevices = function(stdout) {
if (stdout === undefined) { return devices; }

let list = stdout.split('\n');
//First line is always 'known devices'

//First line is always '== Devices =='
list.shift();

list.forEach((item) => {
if (item.trim() === '') { return; }
let split = item.split(/[(]|[[]/g);
for (let item of list) {
let line = item.trim();

if (split[split.length - 1].includes('Simulator')) {
return;
}
if (line === '') { continue; }
if (line === '== Simulators ==') { break; }

let split = item.split(/[(]|[[]/g);

let deviceName = split[0].trim();
//Cant exclude from instruments
//Cant exclude from device list
if (deviceName.includes('MacBook')) {
return;
continue;
}

let apiVersion = split[1].replace(')', '').trim();
let uuid = split[split.length - 1].replace(']', '').trim();
let uuid = split[split.length - 1].replace(')', '').trim();

let device = new Device({
platform: 'ios',
Expand All @@ -35,15 +36,15 @@ const deserializeDevices = function(stdout) {
});

devices.push(device);
});
}

return devices;
};

module.exports = function() {
let list = [
'/usr/bin/instruments',
['-s','devices']
'/usr/bin/xctrace',
['list', 'devices']
];

return spawn(...list).then((output) => {
Expand Down
14 changes: 8 additions & 6 deletions node-tests/unit/targets/ios/tasks/list-devices-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ const expect = require('../../../../helpers/expect');
const Device = require('../../../../../lib/objects/device');
const Promise = require('rsvp').Promise;

const spawnArgs = ['/usr/bin/instruments', ['-s', 'devices']];
const spawnArgs = ['/usr/bin/xctrace', ['list', 'devices']];

//yes - isleofcode.com is my actual device name
//(turn on the hotspot and be branding all conference long!)
const deviceList = `Known Devices
Alex’s MacBook Pro (2) [uuid]
isleofcode.com (12.1.2) [uuid]
Apple TV (12.1) [uuid] (Simulator)
iPhone X (12.1) [uuid] (Simulator)`
const deviceList = `== Devices ==
MacBook Pro (Tomasz) (uuid)
isleofcode.com (12.1.2) (uuid)

== Simulators ==
Apple TV Simulator (12.1) (uuid)
iPhone X Simulator (12.1) (uuid)`

describe('iOS List Emulator Task', () => {
let listDevices;
Expand Down