Skip to content

Commit fba8699

Browse files
Add array destructuring & backwards compatiblity
Signed-off-by: Vipul Gupta (@vipulgupta2048) <[email protected]>
1 parent 6d4cdeb commit fba8699

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

client/bin/multi-client.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,11 @@ class NonInteractiveState {
328328
});
329329
} else if (runConfig.workers instanceof Object) {
330330
await balenaCloud.authenticate(runConfig.workers.apiKey);
331-
if (Array.isArray(runConfig.workers.balenaApplication)) {
332-
const matchingDevices = runConfig.workers.balenaApplication.map(async () => {
333-
await balenaCloud.selectDevicesWithDUT(
334-
runConfig.workers.balenaApplication,
335-
runConfig.deviceType,
336-
)
337-
})
338-
} else {
339-
const matchingDevices = await balenaCloud.selectDevicesWithDUT(
340-
runConfig.workers.balenaApplication,
341-
runConfig.deviceType,
342-
)
331+
let balenaApplications = Array.isArray(runConfig.workers.balenaApplication) ? runConfig.workers.balenaApplication : [runConfig.workers.balenaApplication];
332+
let matchingDevices = []
333+
for (const balenaApplication of balenaApplications) {
334+
matchingDevices = [...(await balenaCloud.selectDevicesWithDUT(balenaApplication, runConfig.deviceType)), ...matchingDevices]
343335
}
344-
345336
console.log(matchingDevices)
346337

347338
// Throw an error if no matching workers are found.

0 commit comments

Comments
 (0)