Skip to content

Commit e6613ab

Browse files
authored
Merge pull request #4794 from NativeScript/fatme/fix-stop-livesync
fix: fix stop run on device when the method is called with empty array
2 parents 6e7d673 + 84a5a0c commit e6613ab

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/controllers/run-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class RunController extends EventEmitter implements IRunController {
6262
// so we cannot await it as this will cause infinite loop.
6363
const shouldAwaitPendingOperation = !stopOptions || stopOptions.shouldAwaitAllActions;
6464

65-
const deviceIdentifiersToRemove = deviceIdentifiers || _.map(liveSyncProcessInfo.deviceDescriptors, d => d.identifier);
65+
const deviceIdentifiersToRemove = (deviceIdentifiers && deviceIdentifiers.length) ? deviceIdentifiers : _.map(liveSyncProcessInfo.deviceDescriptors, d => d.identifier);
6666

6767
const removedDeviceIdentifiers = _.remove(liveSyncProcessInfo.deviceDescriptors, descriptor => _.includes(deviceIdentifiersToRemove, descriptor.identifier))
6868
.map(descriptor => descriptor.identifier);

test/controllers/run-controller.ts

+6
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ describe("RunController", () => {
240240
currentDeviceIdentifiers: ["device1", "device2", "device3"],
241241
expectedDeviceIdentifiers: ["device1"],
242242
deviceIdentifiersToBeStopped: ["device1", "device4"]
243+
},
244+
{
245+
name: "stops LiveSync operation for all devices when stop method is called with empty array",
246+
currentDeviceIdentifiers: ["device1", "device2", "device3"],
247+
expectedDeviceIdentifiers: ["device1", "device2", "device3"],
248+
deviceIdentifiersToBeStopped: []
243249
}
244250
];
245251

0 commit comments

Comments
 (0)