browserstack-cypress-cli 1.13.1 → 1.15.0
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/commands/generateDownloads.js +6 -3
- package/bin/commands/generateReport.js +18 -12
- package/bin/commands/info.js +73 -68
- package/bin/commands/runs.js +59 -24
- package/bin/commands/stop.js +5 -2
- package/bin/helpers/archiver.js +2 -0
- package/bin/helpers/buildArtifacts.js +10 -10
- package/bin/helpers/capabilityHelper.js +16 -0
- package/bin/helpers/checkUploaded.js +3 -1
- package/bin/helpers/config.js +1 -0
- package/bin/helpers/constants.js +15 -3
- package/bin/helpers/fileHelpers.js +1 -0
- package/bin/helpers/getInitialDetails.js +41 -0
- package/bin/helpers/logger.js +26 -16
- package/bin/helpers/packageInstaller.js +19 -3
- package/bin/helpers/reporterHTML.js +3 -3
- package/bin/helpers/sync/failedSpecsDetails.js +12 -4
- package/bin/helpers/sync/specsSummary.js +27 -3
- package/bin/helpers/sync/syncSpecsLogs.js +42 -18
- package/bin/helpers/syncRunner.js +7 -3
- package/bin/helpers/usageReporting.js +26 -2
- package/bin/helpers/utils.js +124 -13
- package/bin/helpers/zipUpload.js +8 -1
- package/bin/runner.js +29 -0
- package/log/usage.log +2 -0
- package/package.json +2 -2
package/bin/helpers/utils.js
CHANGED
|
@@ -16,7 +16,8 @@ const usageReporting = require("./usageReporting"),
|
|
|
16
16
|
syncCliLogger = require("../helpers/logger").syncCliLogger,
|
|
17
17
|
fileHelpers = require("./fileHelpers"),
|
|
18
18
|
config = require("../helpers/config"),
|
|
19
|
-
pkg = require('../../package.json')
|
|
19
|
+
pkg = require('../../package.json'),
|
|
20
|
+
transports = require('./logger').transports;
|
|
20
21
|
|
|
21
22
|
const request = require('request');
|
|
22
23
|
|
|
@@ -154,6 +155,7 @@ exports.setUsageReportingFlag = (bsConfig, disableUsageReporting) => {
|
|
|
154
155
|
} else {
|
|
155
156
|
process.env.DISABLE_USAGE_REPORTING = disableUsageReporting;
|
|
156
157
|
}
|
|
158
|
+
logger.debug(`Setting disable_usage_reporting flag as ${process.env.DISABLE_USAGE_REPORTING}`);
|
|
157
159
|
};
|
|
158
160
|
|
|
159
161
|
exports.getParallels = (bsConfig, args) => {
|
|
@@ -180,7 +182,7 @@ exports.setParallels = (bsConfig, args, numOfSpecs) => {
|
|
|
180
182
|
}
|
|
181
183
|
};
|
|
182
184
|
|
|
183
|
-
exports.warnSpecLimit = (bsConfig, args, specFiles, rawArgs) => {
|
|
185
|
+
exports.warnSpecLimit = (bsConfig, args, specFiles, rawArgs, buildReportData) => {
|
|
184
186
|
let expectedCharLength = specFiles.join("").length + Constants.METADATA_CHAR_BUFFER_PER_SPEC * specFiles.length;
|
|
185
187
|
let parallels = bsConfig.run_settings.parallels;
|
|
186
188
|
let combinations = this.getBrowserCombinations(bsConfig).length;
|
|
@@ -194,7 +196,7 @@ exports.warnSpecLimit = (bsConfig, args, specFiles, rawArgs) => {
|
|
|
194
196
|
Constants.userMessages.SPEC_LIMIT_WARNING,
|
|
195
197
|
Constants.messageTypes.WARNING,
|
|
196
198
|
null,
|
|
197
|
-
|
|
199
|
+
buildReportData,
|
|
198
200
|
rawArgs
|
|
199
201
|
);
|
|
200
202
|
}
|
|
@@ -226,6 +228,7 @@ exports.setDefaults = (bsConfig, args) => {
|
|
|
226
228
|
exports.setUsername = (bsConfig, args) => {
|
|
227
229
|
if (!this.isUndefined(args.username)) {
|
|
228
230
|
bsConfig["auth"]["username"] = args.username;
|
|
231
|
+
logger.debug(`Reading username from command line = ${args.username}`);
|
|
229
232
|
} else if (!this.isUndefined(process.env.BROWSERSTACK_USERNAME)) {
|
|
230
233
|
bsConfig["auth"]["username"] = process.env.BROWSERSTACK_USERNAME;
|
|
231
234
|
logger.info(
|
|
@@ -237,6 +240,7 @@ exports.setUsername = (bsConfig, args) => {
|
|
|
237
240
|
exports.setAccessKey = (bsConfig, args) => {
|
|
238
241
|
if (!this.isUndefined(args.key)) {
|
|
239
242
|
bsConfig["auth"]["access_key"] = args.key;
|
|
243
|
+
logger.debug("Reading access_key from command line");
|
|
240
244
|
} else if (!this.isUndefined(process.env.BROWSERSTACK_ACCESS_KEY)) {
|
|
241
245
|
bsConfig["auth"]["access_key"] = process.env.BROWSERSTACK_ACCESS_KEY;
|
|
242
246
|
logger.info(
|
|
@@ -247,6 +251,7 @@ exports.setAccessKey = (bsConfig, args) => {
|
|
|
247
251
|
|
|
248
252
|
exports.setBuildName = (bsConfig, args) => {
|
|
249
253
|
if (!this.isUndefined(args["build-name"])) {
|
|
254
|
+
logger.debug(`Reading build name from command line = ${args["build-name"]}`);
|
|
250
255
|
bsConfig["run_settings"]["build_name"] = args["build-name"];
|
|
251
256
|
}
|
|
252
257
|
};
|
|
@@ -286,6 +291,8 @@ exports.setCypressConfigFilename = (bsConfig, args) => {
|
|
|
286
291
|
bsConfig.run_settings.cypressConfigFilePath = path.join(bsConfig.run_settings.cypress_proj_dir, 'cypress.json');
|
|
287
292
|
bsConfig.run_settings.cypressProjectDir = bsConfig.run_settings.cypress_proj_dir;
|
|
288
293
|
}
|
|
294
|
+
logger.debug(`Setting cypress config file path = ${bsConfig.run_settings.cypressConfigFilePath}`);
|
|
295
|
+
logger.debug(`Setting cypress project dir = ${bsConfig.run_settings.cypressProjDir}`);
|
|
289
296
|
}
|
|
290
297
|
|
|
291
298
|
exports.verifyGeolocationOption = () => {
|
|
@@ -308,6 +315,7 @@ exports.setGeolocation = (bsConfig, args) => {
|
|
|
308
315
|
} else {
|
|
309
316
|
bsConfig.run_settings.geolocation = bsConfig.run_settings.geolocation.toUpperCase();
|
|
310
317
|
}
|
|
318
|
+
logger.debug(`Setting geolocation = ${bsConfig.run_settings.geolocation}`);
|
|
311
319
|
}
|
|
312
320
|
|
|
313
321
|
exports.isSpecTimeoutArgPassed = () => {
|
|
@@ -325,6 +333,72 @@ exports.setSpecTimeout = (bsConfig, args) => {
|
|
|
325
333
|
specTimeout = bsConfig.run_settings.spec_timeout;
|
|
326
334
|
}
|
|
327
335
|
bsConfig.run_settings.spec_timeout = specTimeout;
|
|
336
|
+
logger.debug(`Setting spec timeout = ${specTimeout}`);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
exports.setRecordFlag = (bsConfig, args) => {
|
|
340
|
+
if(!this.isUndefined(args["record"])) {
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
return bsConfig.run_settings["record"];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
exports.setRecordKeyFlag = (bsConfig, args) => {
|
|
347
|
+
if(!this.isUndefined(args["record-key"])) {
|
|
348
|
+
return args["record-key"];
|
|
349
|
+
} else if (!this.isUndefined(process.env.CYPRESS_RECORD_KEY)) {
|
|
350
|
+
return process.env.CYPRESS_RECORD_KEY;
|
|
351
|
+
}
|
|
352
|
+
return bsConfig.run_settings["record-key"];
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
exports.setProjectId = (bsConfig, args) => {
|
|
356
|
+
if(!this.isUndefined(args["projectId"])) {
|
|
357
|
+
return args["projectId"];
|
|
358
|
+
} else if(!this.isUndefined(process.env.CYPRESS_PROJECT_ID)) {
|
|
359
|
+
return process.env.CYPRESS_PROJECT_ID;
|
|
360
|
+
} else if(!this.isUndefined(bsConfig.run_settings["projectId"])) {
|
|
361
|
+
return bsConfig.run_settings["projectId"];
|
|
362
|
+
} else {
|
|
363
|
+
let cypressJson = this.getCypressJSON(bsConfig);
|
|
364
|
+
if (!this.isUndefined(cypressJson) && !this.isUndefined(cypressJson["projectId"])) { return cypressJson["projectId"]; }
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
exports.setRecordCaps = (bsConfig, args) => {
|
|
369
|
+
bsConfig.run_settings["record"] = this.setRecordFlag(bsConfig, args);
|
|
370
|
+
bsConfig.run_settings["record-key"] = this.setRecordKeyFlag(bsConfig, args);
|
|
371
|
+
bsConfig.run_settings["projectId"] = this.setProjectId(bsConfig, args);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
exports.verifyNodeVersionOption = () => {
|
|
375
|
+
let nvOptionsSet = (this.searchForOption('-nv') || this.searchForOption('--nv'));
|
|
376
|
+
let nodeVersionHyphenLocationOptionsSet = (this.searchForOption('-node-version') || this.searchForOption('--node-version'));
|
|
377
|
+
let nodeVersionOptionsSet = (this.searchForOption('-nodeVersion') || this.searchForOption('--nodeVersion'));
|
|
378
|
+
return (nvOptionsSet || nodeVersionHyphenLocationOptionsSet || nodeVersionOptionsSet);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
exports.setNodeVersion = (bsConfig, args) => {
|
|
382
|
+
let userProvidedNodeVersion = this.verifyNodeVersionOption();
|
|
383
|
+
bsConfig.run_settings.userProvidedNodeVersion = (userProvidedNodeVersion || (!this.isUndefined(bsConfig.run_settings.nodeVersion)) || (!this.isUndefined(bsConfig.run_settings.nodeversion)));
|
|
384
|
+
|
|
385
|
+
if (bsConfig.run_settings.userProvidedNodeVersion) {
|
|
386
|
+
if(!this.isUndefined(args.nodeVersion)) {
|
|
387
|
+
bsConfig.run_settings.nodeVersion = args.nodeVersion;
|
|
388
|
+
} else if (!this.isUndefined(bsConfig.run_settings.nodeversion)) {
|
|
389
|
+
bsConfig.run_settings.nodeVersion = bsConfig.run_settings.nodeversion;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (this.isUndefined(bsConfig.run_settings.nodeVersion)) {
|
|
394
|
+
bsConfig.run_settings.nodeVersion = usageReporting.get_version('node') || '';
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (bsConfig.run_settings.nodeVersion && typeof(bsConfig.run_settings.nodeVersion) === 'string' && bsConfig.run_settings.nodeVersion.charAt(0).toLowerCase() === 'v') {
|
|
398
|
+
bsConfig.run_settings.nodeVersion = bsConfig.run_settings.nodeVersion.substr(1);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
logger.debug(`Setting nodeVersion = ${bsConfig.run_settings.nodeVersion}`);
|
|
328
402
|
}
|
|
329
403
|
|
|
330
404
|
// specs can be passed from bstack configuration file
|
|
@@ -335,6 +409,7 @@ exports.setUserSpecs = (bsConfig, args) => {
|
|
|
335
409
|
|
|
336
410
|
if (!this.isUndefined(args.specs)) {
|
|
337
411
|
bsConfig.run_settings.specs = this.fixCommaSeparatedString(args.specs);
|
|
412
|
+
logger.debug(`Specs provided to run using CLI argument = ${bsConfig.run_settings.specs}`);
|
|
338
413
|
} else if (!this.isUndefined(bsConfigSpecs) && Array.isArray(bsConfigSpecs)) {
|
|
339
414
|
bsConfig.run_settings.specs = bsConfigSpecs.join(',');
|
|
340
415
|
} else if (!this.isUndefined(bsConfigSpecs) && typeof(bsConfigSpecs) == "string") {
|
|
@@ -365,6 +440,8 @@ exports.setTestEnvs = (bsConfig, args) => {
|
|
|
365
440
|
} else {
|
|
366
441
|
bsConfig.run_settings.env = Object.keys(envKeys).map(key => (`${key}=${envKeys[key]}`)).join(',');
|
|
367
442
|
}
|
|
443
|
+
|
|
444
|
+
logger.debug(`Setting env vars = ${bsConfig.run_settings.env}`);
|
|
368
445
|
}
|
|
369
446
|
|
|
370
447
|
exports.setSystemEnvs = (bsConfig) => {
|
|
@@ -392,6 +469,8 @@ exports.setSystemEnvs = (bsConfig) => {
|
|
|
392
469
|
} else {
|
|
393
470
|
bsConfig.run_settings.system_env_vars = Object.keys(envKeys).map(key => (`${key}=${envKeys[key]}`));
|
|
394
471
|
}
|
|
472
|
+
|
|
473
|
+
logger.debug(`Setting system env vars = ${bsConfig.run_settings.system_env_vars}`);
|
|
395
474
|
}
|
|
396
475
|
|
|
397
476
|
exports.getKeysMatchingPattern = (obj, pattern) => {
|
|
@@ -466,6 +545,7 @@ exports.configCreated = (args) => {
|
|
|
466
545
|
|
|
467
546
|
exports.exportResults = (buildId, buildUrl) => {
|
|
468
547
|
let data = "BUILD_ID=" + buildId + "\nBUILD_URL=" + buildUrl;
|
|
548
|
+
logger.debug("Writing build results to log/build_results.txt");
|
|
469
549
|
fs.writeFileSync("log/build_results.txt", data, function (err) {
|
|
470
550
|
if (err) {
|
|
471
551
|
logger.warn(
|
|
@@ -586,6 +666,7 @@ exports.setLocal = (bsConfig, args) => {
|
|
|
586
666
|
local = true;
|
|
587
667
|
}
|
|
588
668
|
bsConfig['connection_settings']['local'] = local;
|
|
669
|
+
logger.debug(`Reading local setting from command line as ${local}`);
|
|
589
670
|
} else if (!this.isUndefined(process.env.BROWSERSTACK_LOCAL)) {
|
|
590
671
|
let local = false;
|
|
591
672
|
if (String(process.env.BROWSERSTACK_LOCAL).toLowerCase() === 'true') {
|
|
@@ -660,10 +741,11 @@ exports.setLocalMode = (bsConfig, args) => {
|
|
|
660
741
|
if (localModeInferred && localModeUndefined) {
|
|
661
742
|
bsConfig.connection_settings.local_mode_inferred = local_mode;
|
|
662
743
|
}
|
|
744
|
+
logger.debug(`local_mode set to ${bsConfig.connection_settings.local_mode_inferred}`);
|
|
663
745
|
}
|
|
664
746
|
};
|
|
665
747
|
|
|
666
|
-
exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
748
|
+
exports.setupLocalTesting = (bsConfig, args, rawArgs, buildReportData) => {
|
|
667
749
|
return new Promise(async (resolve, reject) => {
|
|
668
750
|
if( bsConfig['connection_settings'] && bsConfig['connection_settings']['local'] && String(bsConfig['connection_settings']['local']) === "true" ){
|
|
669
751
|
let localBinaryRunning = await this.checkLocalBinaryRunning(bsConfig, bsConfig['connection_settings']['local_identifier']);
|
|
@@ -679,6 +761,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
679
761
|
process.env.BSTACK_CYPRESS_LOCAL_BINARY_RUNNING = "true";
|
|
680
762
|
}
|
|
681
763
|
if (!localIdentifierRunning){
|
|
764
|
+
logger.debug(`Local binary with identifier ${bsConfig["connection_settings"]["local_identifier"]} not running. Starting a new connection.`);
|
|
682
765
|
bsConfig.connection_settings.usedAutoLocal = true;
|
|
683
766
|
var bs_local = this.getLocalBinary();
|
|
684
767
|
var bs_local_args = this.setLocalArgs(bsConfig, args);
|
|
@@ -689,6 +772,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
689
772
|
process.env.BSTACK_CYPRESS_LOCAL_BINARY_RUNNING = "true";
|
|
690
773
|
resolve(bs_local);
|
|
691
774
|
} else {
|
|
775
|
+
logger.debug(`Error occured while starting a new Local connection with error :`,localStartError);
|
|
692
776
|
let message = `name: ${localStartError.name}, message: ${localStartError.message}, extra: ${localStartError.extra}`,
|
|
693
777
|
errorCode = "local_start_error";
|
|
694
778
|
that.sendUsageReport(
|
|
@@ -697,7 +781,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
697
781
|
message,
|
|
698
782
|
Constants.messageTypes.ERROR,
|
|
699
783
|
errorCode,
|
|
700
|
-
|
|
784
|
+
buildReportData,
|
|
701
785
|
rawArgs
|
|
702
786
|
);
|
|
703
787
|
reject(Constants.userMessages.LOCAL_START_FAILED);
|
|
@@ -712,7 +796,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
712
796
|
});
|
|
713
797
|
};
|
|
714
798
|
|
|
715
|
-
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
799
|
+
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs, buildReportData) => {
|
|
716
800
|
return new Promise(async (resolve, reject) => {
|
|
717
801
|
if (!this.isUndefined(bs_local) && bs_local.isRunning() && bsConfig['connection_settings'] && bsConfig['connection_settings']['local_mode'].toLowerCase() != "always-on") {
|
|
718
802
|
let that = this;
|
|
@@ -720,6 +804,7 @@ exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
|
720
804
|
if (that.isUndefined(localStopError)) {
|
|
721
805
|
resolve();
|
|
722
806
|
} else {
|
|
807
|
+
logger.debug(`Stopping local binary failed with error`, localStopError);
|
|
723
808
|
let message = `name: ${localStopError.name}, message: ${localStopError.message}, extra: ${localStopError.extra}`,
|
|
724
809
|
errorCode = 'local_stop_error';
|
|
725
810
|
that.sendUsageReport(
|
|
@@ -728,7 +813,7 @@ exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
|
728
813
|
message,
|
|
729
814
|
Constants.messageTypes.ERROR,
|
|
730
815
|
errorCode,
|
|
731
|
-
|
|
816
|
+
buildReportData,
|
|
732
817
|
rawArgs
|
|
733
818
|
);
|
|
734
819
|
resolve(Constants.userMessages.LOCAL_STOP_FAILED);
|
|
@@ -768,6 +853,7 @@ exports.generateLocalIdentifier = (mode) => {
|
|
|
768
853
|
};
|
|
769
854
|
|
|
770
855
|
exports.checkLocalBinaryRunning = (bsConfig, localIdentifier) => {
|
|
856
|
+
logger.debug("Checking if local binary running");
|
|
771
857
|
let options = {
|
|
772
858
|
url: `${config.cypress_v1}/local_binary_running_check`,
|
|
773
859
|
auth: {
|
|
@@ -794,6 +880,7 @@ exports.checkLocalBinaryRunning = (bsConfig, localIdentifier) => {
|
|
|
794
880
|
exports.setLocalConfigFile = (bsConfig, args) => {
|
|
795
881
|
if(!this.isUndefined(args.localConfigFile)){
|
|
796
882
|
bsConfig['connection_settings']['local_config_file'] = args.localConfigFile;
|
|
883
|
+
logger.debug(`local_config_file set to ${bsConfig['connection_settings']['local_config_file']}`);
|
|
797
884
|
}
|
|
798
885
|
};
|
|
799
886
|
|
|
@@ -801,6 +888,7 @@ exports.setHeaded = (bsConfig, args) => {
|
|
|
801
888
|
if (!this.isUndefined(args.headed) && args.headed === true) {
|
|
802
889
|
bsConfig.run_settings.headless = false;
|
|
803
890
|
}
|
|
891
|
+
logger.debug(`headless mode set to ${bsConfig.run_settings.headless}`);
|
|
804
892
|
};
|
|
805
893
|
|
|
806
894
|
exports.setNoWrap = (_bsConfig, args) => {
|
|
@@ -809,6 +897,7 @@ exports.setNoWrap = (_bsConfig, args) => {
|
|
|
809
897
|
} else {
|
|
810
898
|
process.env.SYNC_NO_WRAP = false;
|
|
811
899
|
}
|
|
900
|
+
logger.debug(`no-wrap set to ${process.env.SYNC_NO_WRAP}`);
|
|
812
901
|
}
|
|
813
902
|
|
|
814
903
|
exports.getFilesToIgnore = (runSettings, excludeFiles, logging = true) => {
|
|
@@ -833,6 +922,7 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressJson) => {
|
|
|
833
922
|
let globSearchPattern = this.sanitizeSpecsPattern(bsConfig.run_settings.specs) || `${testFolderPath}/**/*.+(${Constants.specFileTypes.join("|")})`;
|
|
834
923
|
let ignoreFiles = args.exclude || bsConfig.run_settings.exclude;
|
|
835
924
|
let files = glob.sync(globSearchPattern, {cwd: bsConfig.run_settings.cypressProjectDir, matchBase: true, ignore: ignoreFiles});
|
|
925
|
+
logger.debug(`${files ? files.length : 0} spec files found at ${testFolderPath}`);
|
|
836
926
|
return files;
|
|
837
927
|
};
|
|
838
928
|
|
|
@@ -949,6 +1039,7 @@ exports.setBrowsers = async (bsConfig, args) => {
|
|
|
949
1039
|
browserHash['versions'].push(this.isUndefined(browserDetails[1]) ? "latest" : browserDetails[1].trim())
|
|
950
1040
|
bsConfig["browsers"].push(browserHash)
|
|
951
1041
|
});
|
|
1042
|
+
logger.debug(`Browsers provided ${bsConfig["browsers"]}`);
|
|
952
1043
|
} catch(err){
|
|
953
1044
|
reject(Constants.validationMessages.INVALID_BROWSER_ARGS)
|
|
954
1045
|
}
|
|
@@ -960,6 +1051,7 @@ exports.setBrowsers = async (bsConfig, args) => {
|
|
|
960
1051
|
exports.setConfig = (bsConfig, args) => {
|
|
961
1052
|
if (!this.isUndefined(args.config)) {
|
|
962
1053
|
bsConfig["run_settings"]["config"] = args.config
|
|
1054
|
+
logger.debug(`Config set to ${bsConfig["run_settings"]["config"]}`);
|
|
963
1055
|
}
|
|
964
1056
|
}
|
|
965
1057
|
|
|
@@ -967,9 +1059,11 @@ exports.setConfig = (bsConfig, args) => {
|
|
|
967
1059
|
exports.setOtherConfigs = (bsConfig, args) => {
|
|
968
1060
|
if (!this.isUndefined(args.reporter)) {
|
|
969
1061
|
bsConfig["run_settings"]["reporter"] = args.reporter;
|
|
1062
|
+
logger.debug(`reporter set to ${args.reporter}`);
|
|
970
1063
|
}
|
|
971
1064
|
if (!this.isUndefined(args.reporterOptions)) {
|
|
972
1065
|
bsConfig["run_settings"]["reporter_options"] = args.reporterOptions;
|
|
1066
|
+
logger.debug(`reporter-options set to ${args.reporterOptions}`);
|
|
973
1067
|
}
|
|
974
1068
|
}
|
|
975
1069
|
|
|
@@ -1001,6 +1095,7 @@ exports.setCLIMode = (bsConfig, args) => {
|
|
|
1001
1095
|
if(!this.isUndefined(args.async) && args.async){
|
|
1002
1096
|
args.sync = false;
|
|
1003
1097
|
}
|
|
1098
|
+
logger.debug(`sync mode set to ${args.sync}`);
|
|
1004
1099
|
}
|
|
1005
1100
|
|
|
1006
1101
|
exports.formatRequest = (err, resp, body) => {
|
|
@@ -1011,7 +1106,20 @@ exports.formatRequest = (err, resp, body) => {
|
|
|
1011
1106
|
}
|
|
1012
1107
|
}
|
|
1013
1108
|
|
|
1014
|
-
exports.
|
|
1109
|
+
exports.setDebugMode = (args) => {
|
|
1110
|
+
if(args.cliDebug || String(process.env.DEBUG).toLowerCase() === 'true'){
|
|
1111
|
+
args.cliDebug ?
|
|
1112
|
+
logger.info("CLI is running with the --cli-debug argument. Running CLI in the debug mode...") :
|
|
1113
|
+
logger.info("DEBUG environment variable set to 'true'. Running CLI in the debug mode...") ;
|
|
1114
|
+
transports.loggerConsole.level = 'debug';
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
transports.loggerConsole.level = 'info';
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs, buildReportData = null) => {
|
|
1015
1123
|
let that = this;
|
|
1016
1124
|
return new Promise(function (resolve, reject) {
|
|
1017
1125
|
let url = config.buildStopUrl + buildId;
|
|
@@ -1074,7 +1182,7 @@ exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs) => {
|
|
|
1074
1182
|
errorCode = 'api_failed_build_stop';
|
|
1075
1183
|
logger.info(message);
|
|
1076
1184
|
} finally {
|
|
1077
|
-
that.sendUsageReport(bsConfig, args, message, messageType, errorCode,
|
|
1185
|
+
that.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs);
|
|
1078
1186
|
}
|
|
1079
1187
|
}
|
|
1080
1188
|
resolve();
|
|
@@ -1082,12 +1190,13 @@ exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs) => {
|
|
|
1082
1190
|
});
|
|
1083
1191
|
}
|
|
1084
1192
|
|
|
1085
|
-
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args) => {
|
|
1193
|
+
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args, buildReportData) => {
|
|
1086
1194
|
let bindData = {
|
|
1087
1195
|
buildId: buildId,
|
|
1088
1196
|
bsConfig: bsConfig,
|
|
1089
1197
|
bsLocalInstance: bsLocal,
|
|
1090
|
-
args: args
|
|
1198
|
+
args: args,
|
|
1199
|
+
buildReportData: buildReportData
|
|
1091
1200
|
}
|
|
1092
1201
|
process.on('SIGINT', processExitHandler.bind(this, bindData));
|
|
1093
1202
|
process.on('SIGTERM', processExitHandler.bind(this, bindData));
|
|
@@ -1097,8 +1206,8 @@ exports.setProcessHooks = (buildId, bsConfig, bsLocal, args) => {
|
|
|
1097
1206
|
|
|
1098
1207
|
async function processExitHandler(exitData){
|
|
1099
1208
|
logger.warn(Constants.userMessages.PROCESS_KILL_MESSAGE);
|
|
1100
|
-
await this.stopBrowserStackBuild(exitData.bsConfig, exitData.args, exitData.buildId);
|
|
1101
|
-
await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args);
|
|
1209
|
+
await this.stopBrowserStackBuild(exitData.bsConfig, exitData.args, exitData.buildId, null, exitData.buildReportData);
|
|
1210
|
+
await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args, null, exitData.buildReportData);
|
|
1102
1211
|
process.exit(0);
|
|
1103
1212
|
}
|
|
1104
1213
|
|
|
@@ -1120,5 +1229,7 @@ exports.getVideoConfig = (cypressJson) => {
|
|
|
1120
1229
|
if (!this.isUndefined(cypressJson.video)) conf.video = cypressJson.video;
|
|
1121
1230
|
if (!this.isUndefined(cypressJson.videoUploadOnPasses)) conf.videoUploadOnPasses = cypressJson.videoUploadOnPasses;
|
|
1122
1231
|
|
|
1232
|
+
logger.debug(`Setting video = ${conf.video}`);
|
|
1233
|
+
logger.debug(`Setting videoUploadOnPasses = ${conf.videoUploadOnPasses}`);
|
|
1123
1234
|
return conf;
|
|
1124
1235
|
}
|
package/bin/helpers/zipUpload.js
CHANGED
|
@@ -69,7 +69,11 @@ const uploadSuits = (bsConfig, filePath, opts, obj) => {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
if (!opts.propogateError){
|
|
72
|
-
|
|
72
|
+
purgeUploadBar(obj);
|
|
73
|
+
if (resp.statusCode == 413) {
|
|
74
|
+
return resolve({warn: Constants.userMessages.NODE_MODULES_LIMIT_EXCEEDED.replace("%SIZE%", (size / 1000000).toFixed(2))});
|
|
75
|
+
}
|
|
76
|
+
return resolve({})
|
|
73
77
|
}
|
|
74
78
|
if(responseData && responseData["error"]){
|
|
75
79
|
responseData["time"] = Date.now() - obj.startTime;
|
|
@@ -137,6 +141,9 @@ const uploadCypressZip = (bsConfig, md5data, packageData) => {
|
|
|
137
141
|
let npmPackageUpload = uploadSuits(bsConfig, config.packageFileName, npmOptions, npmPackageZipUploadObj);
|
|
138
142
|
Promise.all([zipUpload, npmPackageUpload]).then(function (uploads) {
|
|
139
143
|
uploads.forEach(upload => {
|
|
144
|
+
if(upload.warn) {
|
|
145
|
+
logger.warn(upload.warn);
|
|
146
|
+
}
|
|
140
147
|
if(upload.zip_url && upload.time) {
|
|
141
148
|
upload.tests_upload_time = upload.time;
|
|
142
149
|
} else if (upload.npm_package_url && upload.time) {
|
package/bin/runner.js
CHANGED
|
@@ -43,11 +43,20 @@ const configFileOptions = {
|
|
|
43
43
|
},
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
const debugModeOptions = {
|
|
47
|
+
'cli-debug': {
|
|
48
|
+
default: false,
|
|
49
|
+
describe: Constants.cliMessages.COMMON.DEBUG,
|
|
50
|
+
type: "boolean"
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
const commonBuildOptions = {
|
|
47
55
|
...configFileOptions,
|
|
48
56
|
...disableUsageReportingOptions,
|
|
49
57
|
...usernameOptions,
|
|
50
58
|
...accessKeyOptions,
|
|
59
|
+
...debugModeOptions,
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
function checkCommands(yargs, argv, numRequired) {
|
|
@@ -243,6 +252,26 @@ var argv = yargs
|
|
|
243
252
|
describe: Constants.cliMessages.RUN.REPORTER_OPTIONS,
|
|
244
253
|
type: "string"
|
|
245
254
|
},
|
|
255
|
+
'record': {
|
|
256
|
+
describe: Constants.cliMessages.RUN.RECORD,
|
|
257
|
+
type: "boolean"
|
|
258
|
+
},
|
|
259
|
+
'record-key': {
|
|
260
|
+
default: undefined,
|
|
261
|
+
describe: Constants.cliMessages.RUN.RECORD_KEY,
|
|
262
|
+
type: "string"
|
|
263
|
+
},
|
|
264
|
+
'projectId': {
|
|
265
|
+
default: undefined,
|
|
266
|
+
describe: Constants.cliMessages.RUN.PROJECT_ID,
|
|
267
|
+
type: "string"
|
|
268
|
+
},
|
|
269
|
+
'nv': {
|
|
270
|
+
alias: ['node-version', 'nodeVersion'],
|
|
271
|
+
default: undefined,
|
|
272
|
+
describe: Constants.cliMessages.RUN.NODE_VERSION,
|
|
273
|
+
type: "string"
|
|
274
|
+
}
|
|
246
275
|
})
|
|
247
276
|
.help('help')
|
|
248
277
|
.wrap(null)
|
package/log/usage.log
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
{"level":"info","message":"Sending {\"event_type\":\"cypress_cli_stats\",\"data\":{\"bstack_json\":\"null\",\"run_settings\":\"\",\"os\":\"darwin\",\"os_version\":\"21.4.0\",\"bstack_json_found_in_pwd\":false,\"cypress_json_found_in_pwd\":false,\"cli_version\":\"1.13.0\",\"cli_path\":\"/Users/rahulnwn/.nvm/versions/node/v12.18.4/lib/node_modules\",\"npm_version\":\"6.14.6\",\"local_cypress_version\":null,\"ci_environment\":null,\"event_timestamp\":\"4/13/2022, 12:39:15 AM\",\"data\":null,\"raw_args\":[\"run\"],\"cli_args\":{\"_\":[\"run\"],\"cf\":\"browserstack.json\",\"config-file\":\"browserstack.json\",\"configFile\":\"browserstack.json\",\"ccf\":\"./cypress.json\",\"cypress-config-file\":\"./cypress.json\",\"cypressConfigFile\":\"./cypress.json\",\"disable-npm-warning\":false,\"disableNpmWarning\":false,\"sync\":true,\"async\":false,\"force-upload\":false,\"forceUpload\":false,\"headed\":false,\"no-wrap\":false,\"noWrap\":false,\"$0\":\"browserstack-cypress\"},\"message_type\":\"error\",\"error_code\":\"bstack_json_invalid_unknown\"}} to http://127.0.0.1:8000/send_event_cy_internal","timestamp":"2022-04-12T19:09:15.315Z"}
|
|
2
|
+
{"level":"info","message":"{\"attempts\":1,\"statusCode\":404}","timestamp":"2022-04-12T19:09:15.365Z"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserstack-cypress-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"archiver": "5.3.0",
|
|
16
16
|
"async": "3.2.3",
|
|
17
|
-
"browserstack-local": "1.
|
|
17
|
+
"browserstack-local": "1.5.1",
|
|
18
18
|
"chalk": "4.1.2",
|
|
19
19
|
"cli-progress": "3.10.0",
|
|
20
20
|
"fs-extra": "8.1.0",
|