Skip to content

Commit da44298

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

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

client/bin/multi-client.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,22 +328,12 @@ 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
}
344336

345-
console.log(matchingDevices)
346-
347337
// Throw an error if no matching workers are found.
348338
if (matchingDevices.length === 0) {
349339
throw new Error(

0 commit comments

Comments
 (0)