browserstack-cypress-cli 1.13.0 → 1.14.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.
- 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 +56 -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 +13 -0
- package/bin/helpers/checkUploaded.js +3 -1
- package/bin/helpers/config.js +1 -0
- package/bin/helpers/constants.js +20 -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 +24 -5
- 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 +36 -7
- package/bin/helpers/utils.js +94 -13
- package/bin/helpers/zipUpload.js +8 -1
- package/bin/runner.js +23 -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,42 @@ 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);
|
|
328
372
|
}
|
|
329
373
|
|
|
330
374
|
// specs can be passed from bstack configuration file
|
|
@@ -335,6 +379,7 @@ exports.setUserSpecs = (bsConfig, args) => {
|
|
|
335
379
|
|
|
336
380
|
if (!this.isUndefined(args.specs)) {
|
|
337
381
|
bsConfig.run_settings.specs = this.fixCommaSeparatedString(args.specs);
|
|
382
|
+
logger.debug(`Specs provided to run using CLI argument = ${bsConfig.run_settings.specs}`);
|
|
338
383
|
} else if (!this.isUndefined(bsConfigSpecs) && Array.isArray(bsConfigSpecs)) {
|
|
339
384
|
bsConfig.run_settings.specs = bsConfigSpecs.join(',');
|
|
340
385
|
} else if (!this.isUndefined(bsConfigSpecs) && typeof(bsConfigSpecs) == "string") {
|
|
@@ -365,6 +410,8 @@ exports.setTestEnvs = (bsConfig, args) => {
|
|
|
365
410
|
} else {
|
|
366
411
|
bsConfig.run_settings.env = Object.keys(envKeys).map(key => (`${key}=${envKeys[key]}`)).join(',');
|
|
367
412
|
}
|
|
413
|
+
|
|
414
|
+
logger.debug(`Setting env vars = ${bsConfig.run_settings.env}`);
|
|
368
415
|
}
|
|
369
416
|
|
|
370
417
|
exports.setSystemEnvs = (bsConfig) => {
|
|
@@ -392,6 +439,8 @@ exports.setSystemEnvs = (bsConfig) => {
|
|
|
392
439
|
} else {
|
|
393
440
|
bsConfig.run_settings.system_env_vars = Object.keys(envKeys).map(key => (`${key}=${envKeys[key]}`));
|
|
394
441
|
}
|
|
442
|
+
|
|
443
|
+
logger.debug(`Setting system env vars = ${bsConfig.run_settings.system_env_vars}`);
|
|
395
444
|
}
|
|
396
445
|
|
|
397
446
|
exports.getKeysMatchingPattern = (obj, pattern) => {
|
|
@@ -466,6 +515,7 @@ exports.configCreated = (args) => {
|
|
|
466
515
|
|
|
467
516
|
exports.exportResults = (buildId, buildUrl) => {
|
|
468
517
|
let data = "BUILD_ID=" + buildId + "\nBUILD_URL=" + buildUrl;
|
|
518
|
+
logger.debug("Writing build results to log/build_results.txt");
|
|
469
519
|
fs.writeFileSync("log/build_results.txt", data, function (err) {
|
|
470
520
|
if (err) {
|
|
471
521
|
logger.warn(
|
|
@@ -586,6 +636,7 @@ exports.setLocal = (bsConfig, args) => {
|
|
|
586
636
|
local = true;
|
|
587
637
|
}
|
|
588
638
|
bsConfig['connection_settings']['local'] = local;
|
|
639
|
+
logger.debug(`Reading local setting from command line as ${local}`);
|
|
589
640
|
} else if (!this.isUndefined(process.env.BROWSERSTACK_LOCAL)) {
|
|
590
641
|
let local = false;
|
|
591
642
|
if (String(process.env.BROWSERSTACK_LOCAL).toLowerCase() === 'true') {
|
|
@@ -660,10 +711,11 @@ exports.setLocalMode = (bsConfig, args) => {
|
|
|
660
711
|
if (localModeInferred && localModeUndefined) {
|
|
661
712
|
bsConfig.connection_settings.local_mode_inferred = local_mode;
|
|
662
713
|
}
|
|
714
|
+
logger.debug(`local_mode set to ${bsConfig.connection_settings.local_mode_inferred}`);
|
|
663
715
|
}
|
|
664
716
|
};
|
|
665
717
|
|
|
666
|
-
exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
718
|
+
exports.setupLocalTesting = (bsConfig, args, rawArgs, buildReportData) => {
|
|
667
719
|
return new Promise(async (resolve, reject) => {
|
|
668
720
|
if( bsConfig['connection_settings'] && bsConfig['connection_settings']['local'] && String(bsConfig['connection_settings']['local']) === "true" ){
|
|
669
721
|
let localBinaryRunning = await this.checkLocalBinaryRunning(bsConfig, bsConfig['connection_settings']['local_identifier']);
|
|
@@ -679,6 +731,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
679
731
|
process.env.BSTACK_CYPRESS_LOCAL_BINARY_RUNNING = "true";
|
|
680
732
|
}
|
|
681
733
|
if (!localIdentifierRunning){
|
|
734
|
+
logger.debug(`Local binary with identifier ${bsConfig["connection_settings"]["local_identifier"]} not running. Starting a new connection.`);
|
|
682
735
|
bsConfig.connection_settings.usedAutoLocal = true;
|
|
683
736
|
var bs_local = this.getLocalBinary();
|
|
684
737
|
var bs_local_args = this.setLocalArgs(bsConfig, args);
|
|
@@ -689,6 +742,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
689
742
|
process.env.BSTACK_CYPRESS_LOCAL_BINARY_RUNNING = "true";
|
|
690
743
|
resolve(bs_local);
|
|
691
744
|
} else {
|
|
745
|
+
logger.debug(`Error occured while starting a new Local connection with error :`,localStartError);
|
|
692
746
|
let message = `name: ${localStartError.name}, message: ${localStartError.message}, extra: ${localStartError.extra}`,
|
|
693
747
|
errorCode = "local_start_error";
|
|
694
748
|
that.sendUsageReport(
|
|
@@ -697,7 +751,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
697
751
|
message,
|
|
698
752
|
Constants.messageTypes.ERROR,
|
|
699
753
|
errorCode,
|
|
700
|
-
|
|
754
|
+
buildReportData,
|
|
701
755
|
rawArgs
|
|
702
756
|
);
|
|
703
757
|
reject(Constants.userMessages.LOCAL_START_FAILED);
|
|
@@ -712,7 +766,7 @@ exports.setupLocalTesting = (bsConfig, args, rawArgs) => {
|
|
|
712
766
|
});
|
|
713
767
|
};
|
|
714
768
|
|
|
715
|
-
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
769
|
+
exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs, buildReportData) => {
|
|
716
770
|
return new Promise(async (resolve, reject) => {
|
|
717
771
|
if (!this.isUndefined(bs_local) && bs_local.isRunning() && bsConfig['connection_settings'] && bsConfig['connection_settings']['local_mode'].toLowerCase() != "always-on") {
|
|
718
772
|
let that = this;
|
|
@@ -720,6 +774,7 @@ exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
|
720
774
|
if (that.isUndefined(localStopError)) {
|
|
721
775
|
resolve();
|
|
722
776
|
} else {
|
|
777
|
+
logger.debug(`Stopping local binary failed with error`, localStopError);
|
|
723
778
|
let message = `name: ${localStopError.name}, message: ${localStopError.message}, extra: ${localStopError.extra}`,
|
|
724
779
|
errorCode = 'local_stop_error';
|
|
725
780
|
that.sendUsageReport(
|
|
@@ -728,7 +783,7 @@ exports.stopLocalBinary = (bsConfig, bs_local, args, rawArgs) => {
|
|
|
728
783
|
message,
|
|
729
784
|
Constants.messageTypes.ERROR,
|
|
730
785
|
errorCode,
|
|
731
|
-
|
|
786
|
+
buildReportData,
|
|
732
787
|
rawArgs
|
|
733
788
|
);
|
|
734
789
|
resolve(Constants.userMessages.LOCAL_STOP_FAILED);
|
|
@@ -768,6 +823,7 @@ exports.generateLocalIdentifier = (mode) => {
|
|
|
768
823
|
};
|
|
769
824
|
|
|
770
825
|
exports.checkLocalBinaryRunning = (bsConfig, localIdentifier) => {
|
|
826
|
+
logger.debug("Checking if local binary running");
|
|
771
827
|
let options = {
|
|
772
828
|
url: `${config.cypress_v1}/local_binary_running_check`,
|
|
773
829
|
auth: {
|
|
@@ -794,6 +850,7 @@ exports.checkLocalBinaryRunning = (bsConfig, localIdentifier) => {
|
|
|
794
850
|
exports.setLocalConfigFile = (bsConfig, args) => {
|
|
795
851
|
if(!this.isUndefined(args.localConfigFile)){
|
|
796
852
|
bsConfig['connection_settings']['local_config_file'] = args.localConfigFile;
|
|
853
|
+
logger.debug(`local_config_file set to ${bsConfig['connection_settings']['local_config_file']}`);
|
|
797
854
|
}
|
|
798
855
|
};
|
|
799
856
|
|
|
@@ -801,6 +858,7 @@ exports.setHeaded = (bsConfig, args) => {
|
|
|
801
858
|
if (!this.isUndefined(args.headed) && args.headed === true) {
|
|
802
859
|
bsConfig.run_settings.headless = false;
|
|
803
860
|
}
|
|
861
|
+
logger.debug(`headless mode set to ${bsConfig.run_settings.headless}`);
|
|
804
862
|
};
|
|
805
863
|
|
|
806
864
|
exports.setNoWrap = (_bsConfig, args) => {
|
|
@@ -809,6 +867,7 @@ exports.setNoWrap = (_bsConfig, args) => {
|
|
|
809
867
|
} else {
|
|
810
868
|
process.env.SYNC_NO_WRAP = false;
|
|
811
869
|
}
|
|
870
|
+
logger.debug(`no-wrap set to ${process.env.SYNC_NO_WRAP}`);
|
|
812
871
|
}
|
|
813
872
|
|
|
814
873
|
exports.getFilesToIgnore = (runSettings, excludeFiles, logging = true) => {
|
|
@@ -833,6 +892,7 @@ exports.getNumberOfSpecFiles = (bsConfig, args, cypressJson) => {
|
|
|
833
892
|
let globSearchPattern = this.sanitizeSpecsPattern(bsConfig.run_settings.specs) || `${testFolderPath}/**/*.+(${Constants.specFileTypes.join("|")})`;
|
|
834
893
|
let ignoreFiles = args.exclude || bsConfig.run_settings.exclude;
|
|
835
894
|
let files = glob.sync(globSearchPattern, {cwd: bsConfig.run_settings.cypressProjectDir, matchBase: true, ignore: ignoreFiles});
|
|
895
|
+
logger.debug(`${files ? files.length : 0} spec files found at ${testFolderPath}`);
|
|
836
896
|
return files;
|
|
837
897
|
};
|
|
838
898
|
|
|
@@ -949,6 +1009,7 @@ exports.setBrowsers = async (bsConfig, args) => {
|
|
|
949
1009
|
browserHash['versions'].push(this.isUndefined(browserDetails[1]) ? "latest" : browserDetails[1].trim())
|
|
950
1010
|
bsConfig["browsers"].push(browserHash)
|
|
951
1011
|
});
|
|
1012
|
+
logger.debug(`Browsers provided ${bsConfig["browsers"]}`);
|
|
952
1013
|
} catch(err){
|
|
953
1014
|
reject(Constants.validationMessages.INVALID_BROWSER_ARGS)
|
|
954
1015
|
}
|
|
@@ -960,6 +1021,7 @@ exports.setBrowsers = async (bsConfig, args) => {
|
|
|
960
1021
|
exports.setConfig = (bsConfig, args) => {
|
|
961
1022
|
if (!this.isUndefined(args.config)) {
|
|
962
1023
|
bsConfig["run_settings"]["config"] = args.config
|
|
1024
|
+
logger.debug(`Config set to ${bsConfig["run_settings"]["config"]}`);
|
|
963
1025
|
}
|
|
964
1026
|
}
|
|
965
1027
|
|
|
@@ -967,9 +1029,11 @@ exports.setConfig = (bsConfig, args) => {
|
|
|
967
1029
|
exports.setOtherConfigs = (bsConfig, args) => {
|
|
968
1030
|
if (!this.isUndefined(args.reporter)) {
|
|
969
1031
|
bsConfig["run_settings"]["reporter"] = args.reporter;
|
|
1032
|
+
logger.debug(`reporter set to ${args.reporter}`);
|
|
970
1033
|
}
|
|
971
1034
|
if (!this.isUndefined(args.reporterOptions)) {
|
|
972
1035
|
bsConfig["run_settings"]["reporter_options"] = args.reporterOptions;
|
|
1036
|
+
logger.debug(`reporter-options set to ${args.reporterOptions}`);
|
|
973
1037
|
}
|
|
974
1038
|
}
|
|
975
1039
|
|
|
@@ -1001,6 +1065,7 @@ exports.setCLIMode = (bsConfig, args) => {
|
|
|
1001
1065
|
if(!this.isUndefined(args.async) && args.async){
|
|
1002
1066
|
args.sync = false;
|
|
1003
1067
|
}
|
|
1068
|
+
logger.debug(`sync mode set to ${args.sync}`);
|
|
1004
1069
|
}
|
|
1005
1070
|
|
|
1006
1071
|
exports.formatRequest = (err, resp, body) => {
|
|
@@ -1011,7 +1076,20 @@ exports.formatRequest = (err, resp, body) => {
|
|
|
1011
1076
|
}
|
|
1012
1077
|
}
|
|
1013
1078
|
|
|
1014
|
-
exports.
|
|
1079
|
+
exports.setDebugMode = (args) => {
|
|
1080
|
+
if(args.cliDebug || String(process.env.DEBUG).toLowerCase() === 'true'){
|
|
1081
|
+
args.cliDebug ?
|
|
1082
|
+
logger.info("CLI is running with the --cli-debug argument. Running CLI in the debug mode...") :
|
|
1083
|
+
logger.info("DEBUG environment variable set to 'true'. Running CLI in the debug mode...") ;
|
|
1084
|
+
transports.loggerConsole.level = 'debug';
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
transports.loggerConsole.level = 'info';
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs, buildReportData = null) => {
|
|
1015
1093
|
let that = this;
|
|
1016
1094
|
return new Promise(function (resolve, reject) {
|
|
1017
1095
|
let url = config.buildStopUrl + buildId;
|
|
@@ -1074,7 +1152,7 @@ exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs) => {
|
|
|
1074
1152
|
errorCode = 'api_failed_build_stop';
|
|
1075
1153
|
logger.info(message);
|
|
1076
1154
|
} finally {
|
|
1077
|
-
that.sendUsageReport(bsConfig, args, message, messageType, errorCode,
|
|
1155
|
+
that.sendUsageReport(bsConfig, args, message, messageType, errorCode, buildReportData, rawArgs);
|
|
1078
1156
|
}
|
|
1079
1157
|
}
|
|
1080
1158
|
resolve();
|
|
@@ -1082,12 +1160,13 @@ exports.stopBrowserStackBuild = async (bsConfig, args, buildId, rawArgs) => {
|
|
|
1082
1160
|
});
|
|
1083
1161
|
}
|
|
1084
1162
|
|
|
1085
|
-
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args) => {
|
|
1163
|
+
exports.setProcessHooks = (buildId, bsConfig, bsLocal, args, buildReportData) => {
|
|
1086
1164
|
let bindData = {
|
|
1087
1165
|
buildId: buildId,
|
|
1088
1166
|
bsConfig: bsConfig,
|
|
1089
1167
|
bsLocalInstance: bsLocal,
|
|
1090
|
-
args: args
|
|
1168
|
+
args: args,
|
|
1169
|
+
buildReportData: buildReportData
|
|
1091
1170
|
}
|
|
1092
1171
|
process.on('SIGINT', processExitHandler.bind(this, bindData));
|
|
1093
1172
|
process.on('SIGTERM', processExitHandler.bind(this, bindData));
|
|
@@ -1097,8 +1176,8 @@ exports.setProcessHooks = (buildId, bsConfig, bsLocal, args) => {
|
|
|
1097
1176
|
|
|
1098
1177
|
async function processExitHandler(exitData){
|
|
1099
1178
|
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);
|
|
1179
|
+
await this.stopBrowserStackBuild(exitData.bsConfig, exitData.args, exitData.buildId, null, exitData.buildReportData);
|
|
1180
|
+
await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args, null, exitData.buildReportData);
|
|
1102
1181
|
process.exit(0);
|
|
1103
1182
|
}
|
|
1104
1183
|
|
|
@@ -1120,5 +1199,7 @@ exports.getVideoConfig = (cypressJson) => {
|
|
|
1120
1199
|
if (!this.isUndefined(cypressJson.video)) conf.video = cypressJson.video;
|
|
1121
1200
|
if (!this.isUndefined(cypressJson.videoUploadOnPasses)) conf.videoUploadOnPasses = cypressJson.videoUploadOnPasses;
|
|
1122
1201
|
|
|
1202
|
+
logger.debug(`Setting video = ${conf.video}`);
|
|
1203
|
+
logger.debug(`Setting videoUploadOnPasses = ${conf.videoUploadOnPasses}`);
|
|
1123
1204
|
return conf;
|
|
1124
1205
|
}
|
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,20 @@ 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
|
+
}
|
|
246
269
|
})
|
|
247
270
|
.help('help')
|
|
248
271
|
.wrap(null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserstack-cypress-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
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",
|