refactor: do not kill adb on UNIX-like systems (#1103)

This commit is contained in:
Raphael von der Grün
2020-10-22 18:03:28 +02:00
committed by GitHub
parent 335b0f2575
commit aada3e813d
3 changed files with 5 additions and 85 deletions
-25
View File
@@ -40,31 +40,6 @@ describe('device', () => {
expect(list).toEqual(DEVICE_LIST);
});
});
it('should kill adb and try to get devices again if none are found the first time, and `lookHarder` is set', () => {
const execaSpy = jasmine.createSpy('execa').and.returnValue(Promise.resolve());
device.__set__('execa', execaSpy);
AdbSpy.devices.and.returnValues(Promise.resolve([]), Promise.resolve(DEVICE_LIST));
return device.list(true).then(list => {
expect(execaSpy).toHaveBeenCalledWith('killall', ['adb']);
expect(list).toBe(DEVICE_LIST);
expect(AdbSpy.devices).toHaveBeenCalledTimes(2);
});
});
it('should return the empty list if killing adb fails', () => {
const emptyDevices = [];
const execaSpy = jasmine.createSpy('execa').and.returnValue(Promise.reject());
device.__set__('execa', execaSpy);
AdbSpy.devices.and.returnValues(Promise.resolve(emptyDevices));
return device.list(true).then(list => {
expect(execaSpy).toHaveBeenCalledWith('killall', ['adb']);
expect(list).toBe(emptyDevices);
expect(AdbSpy.devices).toHaveBeenCalledTimes(1);
});
});
});
describe('resolveTarget', () => {