@devicecloud.dev/dcd 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,6 +43,7 @@ export default class Cloud extends Command {
43
43
  'legacy-upload': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
44
44
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
45
45
  orientation: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
46
+ quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
46
47
  };
47
48
  run(): Promise<void>;
48
49
  }
@@ -53,9 +53,13 @@ class Cloud extends core_1.Command {
53
53
  static flags = constants_1.flags;
54
54
  async run() {
55
55
  try {
56
+ const [major] = process.versions.node.split('.').map(Number);
57
+ if (major < 18) {
58
+ throw new Error(`You are using node version ${major}. DCD requires node version 18 or later`);
59
+ }
56
60
  await (0, methods_1.versionCheck)(this.config.version);
57
61
  const { args, flags, raw } = await this.parse(Cloud);
58
- const { 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, arm64, async, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'legacy-upload': legacyUpload, name, orientation, ...rest } = flags;
62
+ const { 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, arm64, async, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'legacy-upload': legacyUpload, name, orientation, quiet, ...rest } = flags;
59
63
  if (arm64) {
60
64
  (0, cli_ux_1.info)('Contact hello@devicecloud.dev to enquire about arm64 devices');
61
65
  (0, cli_ux_1.exit)();
@@ -284,34 +288,49 @@ class Cloud extends core_1.Command {
284
288
  // poll for the run status every 5 seconds
285
289
  core_1.ux.action.start('Waiting for results', 'Initializing', { stdout: true });
286
290
  (0, cli_ux_1.info)('\nYou can safely close this terminal and the tests will continue\n');
291
+ let sequentialPollFaillures = 0;
287
292
  const intervalId = setInterval(async () => {
288
- const { results: updatedResults } = await (0, methods_1.typeSafeGet)(apiUrl, `/results/${results[0].test_upload_id}`, {
289
- headers: { 'x-app-api-key': apiKey },
290
- });
291
- if (!updatedResults) {
292
- clearInterval(intervalId);
293
- (0, errors_1.error)('No results found');
294
- }
295
- core_1.ux.action.status = '\nStatus Test\n─────────── ───────────────';
296
- for (const { status, test_file_name: test } of updatedResults) {
297
- core_1.ux.action.status += `\n${status.padEnd(10, ' ')} ${test}`;
293
+ try {
294
+ const { results: updatedResults } = await (0, methods_1.typeSafeGet)(apiUrl, `/results/${results[0].test_upload_id}`, {
295
+ headers: { 'x-app-api-key': apiKey },
296
+ });
297
+ if (!updatedResults) {
298
+ throw new Error('no results');
299
+ }
300
+ if (!quiet) {
301
+ core_1.ux.action.status =
302
+ '\nStatus Test\n─────────── ───────────────';
303
+ for (const { status, test_file_name: test } of updatedResults) {
304
+ core_1.ux.action.status += `\n${status.padEnd(10, ' ')} ${test}`;
305
+ }
306
+ }
307
+ if (updatedResults.every((result) => !['PENDING', 'RUNNING'].includes(result.status))) {
308
+ core_1.ux.action.stop('completed');
309
+ (0, cli_ux_1.info)('\n');
310
+ (0, cli_ux_1.table)(updatedResults, {
311
+ status: { get: (row) => row.status },
312
+ test: { get: (row) => row.test_file_name },
313
+ }, { printLine: this.log.bind(this) });
314
+ (0, cli_ux_1.info)('\n');
315
+ (0, cli_ux_1.info)('Run completed, you can access the results at:');
316
+ core_1.ux.url(url, url);
317
+ (0, cli_ux_1.info)('\n');
318
+ clearInterval(intervalId);
319
+ if (updatedResults.some((result) => result.status === 'FAILED')) {
320
+ // eslint-disable-next-line no-process-exit, unicorn/no-process-exit
321
+ process.exit(2);
322
+ }
323
+ sequentialPollFaillures = 0;
324
+ }
298
325
  }
299
- if (updatedResults.every((result) => !['PENDING', 'RUNNING'].includes(result.status))) {
300
- core_1.ux.action.stop('completed');
301
- (0, cli_ux_1.info)('\n');
302
- (0, cli_ux_1.table)(updatedResults, {
303
- status: { get: (row) => row.status },
304
- test: { get: (row) => row.test_file_name },
305
- }, { printLine: this.log.bind(this) });
306
- (0, cli_ux_1.info)('\n');
307
- (0, cli_ux_1.info)('Run completed, you can access the results at:');
308
- core_1.ux.url(url, url);
309
- (0, cli_ux_1.info)('\n');
310
- clearInterval(intervalId);
311
- if (updatedResults.some((result) => result.status === 'FAILED')) {
312
- // eslint-disable-next-line no-process-exit, unicorn/no-process-exit
313
- process.exit(2);
326
+ catch {
327
+ sequentialPollFaillures++;
328
+ if (sequentialPollFaillures > 5) {
329
+ // dropped poll requests shouldn't err user CI
330
+ clearInterval(intervalId);
331
+ throw new Error('unable to fetch results');
314
332
  }
333
+ (0, cli_ux_1.info)('unable to fetch results, trying again...');
315
334
  }
316
335
  }, 5000);
317
336
  }
@@ -19,6 +19,7 @@ export declare const flags: {
19
19
  'legacy-upload': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
20
  name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
21
  orientation: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
22
+ quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
22
23
  };
23
24
  export declare const iOSCompatibilityLookup: {
24
25
  [k in EiOSDevices]: string[];
package/dist/constants.js CHANGED
@@ -114,6 +114,11 @@ exports.flags = {
114
114
  description: '[Android only] The orientation of the device to run your flow against in degrees',
115
115
  options: ['0', '90', '180', '270'],
116
116
  }),
117
+ quiet: core_1.Flags.boolean({
118
+ char: 'q',
119
+ default: false,
120
+ description: 'Quieter console output that wont provide progress updates',
121
+ }),
117
122
  };
118
123
  exports.iOSCompatibilityLookup = {
119
124
  'ipad-pro-6th-gen': ['16', '17'],
package/dist/methods.js CHANGED
@@ -30,7 +30,7 @@ const versionCheck = async (currentVersion) => {
30
30
  (0, cli_ux_1.warn)(`
31
31
  -------------------
32
32
  A new version of the devicecloud.dev CLI is available: ${latestVersion}
33
- Run 'npm install -g @devicecloud.dev/dcd' to update to the latest version
33
+ Run 'npm install -g @devicecloud.dev/dcd@latest' to update to the latest version
34
34
  -------------------
35
35
  `);
36
36
  }
@@ -214,6 +214,13 @@
214
214
  "270"
215
215
  ],
216
216
  "type": "option"
217
+ },
218
+ "quiet": {
219
+ "char": "q",
220
+ "description": "Quieter console output that wont provide progress updates",
221
+ "name": "quiet",
222
+ "allowNo": false,
223
+ "type": "boolean"
217
224
  }
218
225
  },
219
226
  "hasDynamicHelp": false,
@@ -232,5 +239,5 @@
232
239
  ]
233
240
  }
234
241
  },
235
- "version": "1.0.6"
242
+ "version": "1.0.8"
236
243
  }
package/package.json CHANGED
@@ -42,6 +42,9 @@
42
42
  "ts-node": "^10.9.2",
43
43
  "typescript": "^5"
44
44
  },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
45
48
  "files": [
46
49
  "/bin",
47
50
  "/dist",
@@ -77,7 +80,7 @@
77
80
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
78
81
  "version": "oclif readme && git add README.md"
79
82
  },
80
- "version": "1.0.6",
83
+ "version": "1.0.8",
81
84
  "bugs": {
82
85
  "url": "https://discord.gg/gm3mJwcNw8"
83
86
  },