@devicecloud.dev/dcd 2.0.1 → 2.1.1

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.
@@ -32,7 +32,6 @@ export default class Cloud extends Command {
32
32
  apiUrl: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
33
33
  'app-binary-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
34
34
  'app-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
35
- arm64: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
36
35
  async: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
36
  'device-locale': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
38
37
  'download-artifacts': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -55,11 +55,7 @@ class Cloud extends core_1.Command {
55
55
  }
56
56
  await (0, methods_1.versionCheck)(this.config.version);
57
57
  const { args, flags, raw } = await this.parse(Cloud);
58
- const { 'additional-app-binary-ids': nonFlatAdditionalAppBinaryIds, 'additional-app-files': nonFlatAdditionalAppFiles, 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, arm64, async, 'device-locale': deviceLocale, 'download-artifacts': downloadArtifacts, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'maestro-version': maestroVersion, name, orientation, quiet, ...rest } = flags;
59
- if (arm64) {
60
- (0, cli_ux_1.info)('Contact hello@devicecloud.dev to enquire about arm64 devices');
61
- (0, cli_ux_1.exit)();
62
- }
58
+ const { 'additional-app-binary-ids': nonFlatAdditionalAppBinaryIds, 'additional-app-files': nonFlatAdditionalAppFiles, 'android-api-level': androidApiLevel, 'android-device': androidDevice, apiKey, apiUrl, 'app-binary-id': appBinaryId, 'app-file': appFile, async, 'device-locale': deviceLocale, 'download-artifacts': downloadArtifacts, env, 'exclude-flows': excludeFlows, 'exclude-tags': excludeTags, flows, 'google-play': googlePlay, 'include-tags': includeTags, 'ios-device': iOSDevice, 'ios-version': iOSVersion, 'maestro-version': maestroVersion, name, orientation, quiet, ...rest } = flags;
63
59
  if (!apiKey)
64
60
  throw new Error('You must provide an API key');
65
61
  const additionalAppBinaryIds = nonFlatAdditionalAppBinaryIds?.flat();
@@ -101,7 +97,7 @@ class Cloud extends core_1.Command {
101
97
  // eslint-disable-next-line unicorn/no-process-exit
102
98
  process.exit(2);
103
99
  }
104
- const { allExcludeTags, allIncludeTags, flowsToRun: testFileNames, referencedFiles, sequence, } = executionPlan;
100
+ const { allExcludeTags, allIncludeTags, flowsToRun: testFileNames, referencedFiles, sequence, workspaceConfig, } = executionPlan;
105
101
  const pathsShortestToLongest = [
106
102
  ...testFileNames,
107
103
  ...referencedFiles,
@@ -215,6 +211,8 @@ class Cloud extends core_1.Command {
215
211
  testFormData.set('iOSDevice', iOSDevice.toString());
216
212
  if (name)
217
213
  testFormData.set('name', name.toString());
214
+ if (workspaceConfig)
215
+ testFormData.set('workspaceConfig', JSON.stringify(workspaceConfig));
218
216
  for (const [key, value] of Object.entries(rest)) {
219
217
  if (value) {
220
218
  testFormData.set(key, value);
@@ -8,7 +8,6 @@ export declare const flags: {
8
8
  apiUrl: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
9
  'app-binary-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
10
  'app-file': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- arm64: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
11
  async: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
12
  'device-locale': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
13
  'download-artifacts': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
package/dist/constants.js CHANGED
@@ -49,10 +49,6 @@ exports.flags = {
49
49
  aliases: ['app-file'],
50
50
  description: 'App binary to run your flows against',
51
51
  }),
52
- arm64: core_1.Flags.boolean({
53
- default: false,
54
- description: '[Android only] Run your flow against arm64 devices',
55
- }),
56
52
  async: core_1.Flags.boolean({
57
53
  description: 'Wait for the results of the run',
58
54
  }),
package/dist/plan.d.ts CHANGED
@@ -1,3 +1,17 @@
1
+ interface IWorkspaceConfig {
2
+ excludeTags?: null | string[];
3
+ executionOrder?: IExecutionOrder | null;
4
+ flows?: null | string[];
5
+ includeTags?: null | string[];
6
+ local?: ILocal | null;
7
+ }
8
+ interface ILocal {
9
+ deterministicOrder: boolean | null;
10
+ }
11
+ interface IExecutionOrder {
12
+ continueOnFailure: boolean;
13
+ flowsOrder: string[];
14
+ }
1
15
  interface IExecutionPlan {
2
16
  allExcludeTags?: null | string[];
3
17
  allIncludeTags?: null | string[];
@@ -5,6 +19,7 @@ interface IExecutionPlan {
5
19
  referencedFiles: string[];
6
20
  sequence?: IFlowSequence | null;
7
21
  totalFlowFiles: number;
22
+ workspaceConfig?: IWorkspaceConfig;
8
23
  }
9
24
  interface IFlowSequence {
10
25
  continueOnFailure?: boolean;
package/dist/plan.js CHANGED
@@ -130,5 +130,6 @@ async function plan(input, includeTags, excludeTags, excludeFlows) {
130
130
  flows: flowsToRunInSequence,
131
131
  },
132
132
  totalFlowFiles: unfilteredFlowFiles.length,
133
+ workspaceConfig,
133
134
  };
134
135
  }
@@ -35,25 +35,40 @@ function isFlowFile(filePath) {
35
35
  return filePath.endsWith('.yaml') || filePath.endsWith('.yml');
36
36
  }
37
37
  const readYamlFileAsJson = (filePath) => {
38
- const yamlText = fs.readFileSync(filePath, 'utf8');
39
- return yaml.load(yamlText);
38
+ try {
39
+ const yamlText = fs.readFileSync(filePath, 'utf8');
40
+ return yaml.load(yamlText);
41
+ }
42
+ catch (error) {
43
+ const message = `Error parsing YAML file ${filePath}: ${error}`;
44
+ console.error(message);
45
+ throw new Error(message);
46
+ }
40
47
  };
41
48
  exports.readYamlFileAsJson = readYamlFileAsJson;
42
49
  const readTestYamlFileAsJson = (filePath) => {
43
- const yamlText = fs.readFileSync(filePath, 'utf8');
44
- if (yamlText.includes('\n---\n')) {
45
- const yamlTexts = yamlText.split('\n---\n');
46
- const config = yaml.load(yamlTexts[0]);
47
- const testSteps = yaml.load(yamlTexts[1]);
48
- if (Object.keys(config ?? {}).length > 0) {
49
- return { config, testSteps };
50
+ try {
51
+ const yamlText = fs.readFileSync(filePath, 'utf8');
52
+ const normalizedText = yamlText.replaceAll('\r\n', '\n');
53
+ if (normalizedText.includes('\n---\n')) {
54
+ const yamlTexts = normalizedText.split('\n---\n');
55
+ const config = yaml.load(yamlTexts[0]);
56
+ const testSteps = yaml.load(yamlTexts[1]);
57
+ if (Object.keys(config ?? {}).length > 0) {
58
+ return { config, testSteps };
59
+ }
60
+ }
61
+ const testSteps = yaml.load(yamlText);
62
+ if (Object.keys(testSteps).length > 0) {
63
+ return { config: null, testSteps };
50
64
  }
51
- }
52
- const testSteps = yaml.load(yamlText);
53
- if (Object.keys(testSteps).length > 0) {
54
65
  return { config: null, testSteps };
55
66
  }
56
- return { config: null, testSteps };
67
+ catch (error) {
68
+ const message = `Error parsing YAML file ${filePath}: ${error}`;
69
+ console.error(message);
70
+ throw new Error(message);
71
+ }
57
72
  };
58
73
  exports.readTestYamlFileAsJson = readTestYamlFileAsJson;
59
74
  async function readDirectory(dir, filterFunction) {
@@ -104,12 +104,6 @@
104
104
  "multiple": false,
105
105
  "type": "option"
106
106
  },
107
- "arm64": {
108
- "description": "[Android only] Run your flow against arm64 devices",
109
- "name": "arm64",
110
- "allowNo": false,
111
- "type": "boolean"
112
- },
113
107
  "async": {
114
108
  "description": "Wait for the results of the run",
115
109
  "name": "async",
@@ -293,5 +287,5 @@
293
287
  ]
294
288
  }
295
289
  },
296
- "version": "2.0.1"
290
+ "version": "2.1.1"
297
291
  }
package/package.json CHANGED
@@ -80,7 +80,7 @@
80
80
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
81
81
  "version": "oclif readme && git add README.md"
82
82
  },
83
- "version": "2.0.1",
83
+ "version": "2.1.1",
84
84
  "bugs": {
85
85
  "url": "https://discord.gg/gm3mJwcNw8"
86
86
  },