browserstack-cypress-cli 1.9.0 → 1.11.2

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.
package/bin/runner.js CHANGED
@@ -4,6 +4,52 @@ const yargs = require('yargs'),
4
4
  logger = require("./helpers/logger").winstonLogger,
5
5
  Constants = require('./helpers/constants');
6
6
 
7
+
8
+ const disableUsageReportingOptions = {
9
+ 'disable-usage-reporting': {
10
+ default: undefined,
11
+ description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
12
+ type: "boolean"
13
+ },
14
+ }
15
+
16
+ const usernameOptions = {
17
+ 'u': {
18
+ alias: 'username',
19
+ describe: Constants.cliMessages.COMMON.USERNAME,
20
+ type: "string",
21
+ default: undefined
22
+ },
23
+ }
24
+
25
+ const accessKeyOptions = {
26
+ 'k': {
27
+ alias: 'key',
28
+ describe: Constants.cliMessages.COMMON.ACCESS_KEY,
29
+ type: "string",
30
+ default: undefined
31
+ },
32
+ }
33
+
34
+ const configFileOptions = {
35
+ 'cf': {
36
+ alias: 'config-file',
37
+ describe: Constants.cliMessages.COMMON.CONFIG_FILE_PATH,
38
+ default: 'browserstack.json',
39
+ type: 'string',
40
+ nargs: 1,
41
+ demand: true,
42
+ demand: Constants.cliMessages.COMMON.CONFIG_DEMAND
43
+ },
44
+ }
45
+
46
+ const commonBuildOptions = {
47
+ ...configFileOptions,
48
+ ...disableUsageReportingOptions,
49
+ ...usernameOptions,
50
+ ...accessKeyOptions,
51
+ }
52
+
7
53
  function checkCommands(yargs, argv, numRequired) {
8
54
  if (argv._.length < numRequired) {
9
55
  yargs.showHelp()
@@ -21,121 +67,63 @@ var argv = yargs
21
67
  .showHelpOnFail(false, Constants.cliMessages.VERSION.HELP)
22
68
  .demand(1, Constants.cliMessages.VERSION.DEMAND)
23
69
  .command('init', Constants.cliMessages.INIT.INFO, function(yargs) {
70
+ let rawArgv = yargs.argv;
24
71
  argv = yargs
25
72
  .usage("usage: $0 init [filename] [options]")
26
73
  .options({
74
+ ...disableUsageReportingOptions,
27
75
  'p': {
28
76
  alias: "path",
29
77
  default: false,
30
78
  description: Constants.cliMessages.INIT.DESC,
31
79
  type: "string",
32
80
  },
33
- 'disable-usage-reporting': {
34
- default: undefined,
35
- description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
36
- type: "boolean"
37
- },
38
81
  })
39
82
  .help("help")
40
83
  .wrap(null).argv;
41
84
 
42
85
  if (checkCommands(yargs, argv, 1)) {
43
- return require('./commands/init')(argv);
86
+ return require('./commands/init')(argv, rawArgv);
44
87
  }
45
88
  })
46
89
  .command('build-info', Constants.cliMessages.BUILD.INFO, function(yargs) {
90
+ let rawArgv = yargs.argv;
47
91
  argv = yargs
48
92
  .usage('usage: $0 <buildId>')
49
93
  .demand(1, Constants.cliMessages.BUILD.DEMAND)
50
94
  .options({
51
- 'cf': {
52
- alias: 'config-file',
53
- describe: Constants.cliMessages.BUILD.DESC,
54
- default: 'browserstack.json',
55
- type: 'string',
56
- nargs: 1,
57
- demand: true,
58
- demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
59
- },
60
- 'disable-usage-reporting': {
61
- default: undefined,
62
- description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
63
- type: "boolean"
64
- },
65
- 'u': {
66
- alias: 'username',
67
- describe: Constants.cliMessages.COMMON.USERNAME,
68
- type: "string",
69
- default: undefined
70
- },
71
- 'k': {
72
- alias: 'key',
73
- describe: Constants.cliMessages.COMMON.ACCESS_KEY,
74
- type: "string",
75
- default: undefined
76
- },
95
+ ...commonBuildOptions,
77
96
  })
78
97
  .help('help')
79
98
  .wrap(null)
80
99
  .argv
81
100
  if (checkCommands(yargs, argv, 1)) {
82
101
  logger.info(Constants.cliMessages.BUILD.INFO_MESSAGE + argv._[1]);
83
- return require('./commands/info')(argv);
102
+ return require('./commands/info')(argv, rawArgv);
84
103
  }
85
104
  })
86
105
  .command('build-stop', Constants.cliMessages.BUILD.STOP, function (yargs) {
106
+ let rawArgv = yargs.argv;
87
107
  argv = yargs
88
108
  .usage('usage: $0 <buildId>')
89
109
  .demand(1, Constants.cliMessages.BUILD.DEMAND)
90
110
  .options({
91
- 'cf': {
92
- alias: 'config-file',
93
- describe: Constants.cliMessages.BUILD.DESC,
94
- default: 'browserstack.json',
95
- type: 'string',
96
- nargs: 1,
97
- demand: true,
98
- demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
99
- },
100
- 'disable-usage-reporting': {
101
- default: undefined,
102
- description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
103
- type: "boolean"
104
- },
105
- 'u': {
106
- alias: 'username',
107
- describe: Constants.cliMessages.COMMON.USERNAME,
108
- type: "string",
109
- default: undefined
110
- },
111
- 'k': {
112
- alias: 'key',
113
- describe: Constants.cliMessages.COMMON.ACCESS_KEY,
114
- type: "string",
115
- default: undefined
116
- },
111
+ ...commonBuildOptions,
117
112
  })
118
113
  .help('help')
119
114
  .wrap(null)
120
115
  .argv
121
116
  if (checkCommands(yargs, argv, 1)) {
122
117
  logger.info(Constants.cliMessages.BUILD.STOP_MESSAGE + argv._[1]);
123
- return require('./commands/stop')(argv);
118
+ return require('./commands/stop')(argv, rawArgv);
124
119
  }
125
120
  })
126
121
  .command('run', Constants.cliMessages.RUN.INFO, function(yargs) {
122
+ let rawArgv = yargs.argv;
127
123
  argv = yargs
128
124
  .usage('usage: $0 run <options>')
129
125
  .options({
130
- 'cf': {
131
- alias: 'config-file',
132
- describe: Constants.cliMessages.RUN.DESC,
133
- default: 'browserstack.json',
134
- type: 'string',
135
- nargs: 1,
136
- demand: true,
137
- demand: Constants.cliMessages.RUN.CONFIG_DEMAND
138
- },
126
+ ...commonBuildOptions,
139
127
  'ccf': {
140
128
  alias: 'cypress-config-file',
141
129
  describe: Constants.cliMessages.RUN.CYPRESS_DESC,
@@ -145,31 +133,14 @@ var argv = yargs
145
133
  demand: true,
146
134
  demand: Constants.cliMessages.RUN.CYPRESS_CONFIG_DEMAND
147
135
  },
148
- 'disable-usage-reporting': {
149
- default: undefined,
150
- description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
151
- type: "boolean"
152
- },
153
136
  'p': {
154
- alias: 'parallels',
137
+ alias: ['parallels', 'parallel'],
155
138
  describe: Constants.cliMessages.RUN.PARALLEL_DESC,
156
139
  type: "number",
157
140
  default: undefined
158
141
  },
159
- 'u': {
160
- alias: 'username',
161
- describe: Constants.cliMessages.COMMON.USERNAME,
162
- type: "string",
163
- default: undefined
164
- },
165
- 'k': {
166
- alias: 'key',
167
- describe: Constants.cliMessages.COMMON.ACCESS_KEY,
168
- type: "string",
169
- default: undefined
170
- },
171
142
  'b': {
172
- alias: 'build-name',
143
+ alias: ['build-name', 'ci-build-id'],
173
144
  describe: Constants.cliMessages.RUN.BUILD_NAME,
174
145
  type: "string",
175
146
  default: undefined
@@ -197,10 +168,15 @@ var argv = yargs
197
168
  type: "boolean"
198
169
  },
199
170
  'sync': {
200
- default: false,
171
+ default: true,
201
172
  describe: Constants.cliMessages.RUN.SYNC_DESCRIPTION,
202
173
  type: "boolean"
203
174
  },
175
+ 'async': {
176
+ default: false,
177
+ describe: Constants.cliMessages.RUN.ASYNC_DESCRIPTION,
178
+ type: "boolean"
179
+ },
204
180
  'force-upload': {
205
181
  default: false,
206
182
  describe: Constants.cliMessages.COMMON.FORCE_UPLOAD,
@@ -231,53 +207,68 @@ var argv = yargs
231
207
  default: false,
232
208
  describe: Constants.cliMessages.RUN.SYNC_NO_WRAP,
233
209
  type: "boolean"
234
- }
210
+ },
211
+ 'browser': {
212
+ describe: Constants.cliMessages.RUN.BROWSER_DESCRIPTION,
213
+ type: "string",
214
+ default: undefined
215
+ },
216
+ 'c': {
217
+ alias: 'config',
218
+ describe: Constants.cliMessages.RUN.CONFIG_DESCRIPTION,
219
+ type: "string",
220
+ default: undefined
221
+ },
222
+ 'r': {
223
+ alias: 'reporter',
224
+ default: undefined,
225
+ describe: Constants.cliMessages.RUN.REPORTER,
226
+ type: "string"
227
+ },
228
+ 'o': {
229
+ alias: 'reporter-options',
230
+ default: undefined,
231
+ describe: Constants.cliMessages.RUN.REPORTER_OPTIONS,
232
+ type: "string"
233
+ },
235
234
  })
236
235
  .help('help')
237
236
  .wrap(null)
238
237
  .argv
239
238
  if (checkCommands(yargs, argv, 1)) {
240
- return require('./commands/runs')(argv);
239
+ return require('./commands/runs')(argv, rawArgv);
241
240
  }
242
241
  })
243
242
  .command('generate-report', Constants.cliMessages.GENERATE_REPORT.INFO, function(yargs) {
243
+ let rawArgv = yargs.argv;
244
244
  argv = yargs
245
245
  .usage('usage: $0 generate-report <buildId>')
246
246
  .demand(1, Constants.cliMessages.BUILD.DEMAND)
247
247
  .options({
248
- 'cf': {
249
- alias: 'config-file',
250
- describe: Constants.cliMessages.BUILD.DESC,
251
- default: 'browserstack.json',
252
- type: 'string',
253
- nargs: 1,
254
- demand: true,
255
- demand: Constants.cliMessages.BUILD.CONFIG_DEMAND
256
- },
257
- 'disable-usage-reporting': {
258
- default: undefined,
259
- description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
260
- type: "boolean"
261
- },
262
- 'u': {
263
- alias: 'username',
264
- describe: Constants.cliMessages.COMMON.USERNAME,
265
- type: "string",
266
- default: undefined
267
- },
268
- 'k': {
269
- alias: 'key',
270
- describe: Constants.cliMessages.COMMON.ACCESS_KEY,
271
- type: "string",
272
- default: undefined
273
- },
248
+ ...commonBuildOptions,
249
+ })
250
+ .help('help')
251
+ .wrap(null)
252
+ .argv
253
+ if (checkCommands(yargs, argv, 1)) {
254
+ logger.info(Constants.cliMessages.BUILD.INFO_MESSAGE + argv._[1]);
255
+ return require('./commands/generateReport')(argv, rawArgv);
256
+ }
257
+ })
258
+ .command('generate-downloads', Constants.cliMessages.GENERATE_DOWNLOADS.INFO, function(yargs) {
259
+ let rawArgv = yargs.argv;
260
+ argv = yargs
261
+ .usage('usage: $0 generate-downloads <buildId>')
262
+ .demand(1, Constants.cliMessages.BUILD.DEMAND)
263
+ .options({
264
+ ...commonBuildOptions,
274
265
  })
275
266
  .help('help')
276
267
  .wrap(null)
277
268
  .argv
278
269
  if (checkCommands(yargs, argv, 1)) {
279
270
  logger.info(Constants.cliMessages.BUILD.INFO_MESSAGE + argv._[1]);
280
- return require('./commands/generateReport')(argv);
271
+ return require('./commands/generateDownloads')(argv, rawArgv);
281
272
  }
282
273
  })
283
274
  .help('help')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browserstack-cypress-cli",
3
- "version": "1.9.0",
3
+ "version": "1.11.2",
4
4
  "description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,6 +16,7 @@
16
16
  "async": "^3.2.0",
17
17
  "browserstack-local": "^1.4.8",
18
18
  "chalk": "^4.1.0",
19
+ "cli-progress": "^3.9.1",
19
20
  "fs-extra": "^8.1.0",
20
21
  "getmac": "^5.17.0",
21
22
  "glob": "^7.1.6",
@@ -23,10 +24,11 @@
23
24
  "request": "^2.88.0",
24
25
  "requestretry": "^4.1.0",
25
26
  "table": "^5.4.6",
27
+ "unzipper": "^0.10.11",
28
+ "update-notifier": "^5.1.0",
26
29
  "uuid": "^8.3.2",
27
- "winston": "^2.3.1",
28
- "yargs": "^14.2.3",
29
- "axios": "^0.21.1"
30
+ "winston": "2.4.4",
31
+ "yargs": "^14.2.3"
30
32
  },
31
33
  "repository": {
32
34
  "type": "git",