browserstack-cypress-cli 1.10.1 → 1.11.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/.nyc_output/4a952689-f098-4108-8a3e-26deb80519a8.json +1 -0
- package/.nyc_output/97ba506f-6310-4b5c-b0cf-54cdd82c7af6.json +1 -0
- package/.nyc_output/processinfo/4a952689-f098-4108-8a3e-26deb80519a8.json +1 -0
- package/.nyc_output/processinfo/97ba506f-6310-4b5c-b0cf-54cdd82c7af6.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/bin/commands/generateDownloads.js +1 -0
- package/bin/commands/generateReport.js +1 -0
- package/bin/commands/info.js +1 -0
- package/bin/commands/runs.js +139 -91
- package/bin/commands/stop.js +3 -63
- package/bin/helpers/buildArtifacts.js +2 -0
- package/bin/helpers/capabilityHelper.js +8 -0
- package/bin/helpers/checkUploaded.js +47 -14
- package/bin/helpers/config.js +2 -0
- package/bin/helpers/constants.js +31 -6
- package/bin/helpers/fileHelpers.js +14 -0
- package/bin/helpers/packageInstaller.js +138 -0
- package/bin/helpers/reporterHTML.js +8 -2
- package/bin/helpers/sync/syncSpecsLogs.js +2 -0
- package/bin/helpers/utils.js +194 -2
- package/bin/helpers/zipUpload.js +40 -28
- package/bin/runner.js +6 -1
- package/package.json +4 -2
- package/.nyc_output/8250a512-572d-46ce-b8a0-1994c1cafa91.json +0 -1
- package/.nyc_output/c4d99e47-3a09-4e3a-9b8d-5fd3063b36ae.json +0 -1
- package/.nyc_output/processinfo/8250a512-572d-46ce-b8a0-1994c1cafa91.json +0 -1
- package/.nyc_output/processinfo/c4d99e47-3a09-4e3a-9b8d-5fd3063b36ae.json +0 -1
- package/log/usage.log +0 -16
package/bin/helpers/zipUpload.js
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const config = require("./config"),
|
|
3
3
|
request = require("request"),
|
|
4
|
-
fs = require("fs"),
|
|
5
4
|
logger = require("./logger").winstonLogger,
|
|
6
5
|
Constants = require("./constants"),
|
|
7
|
-
utils = require("./utils")
|
|
8
|
-
fileHelpers = require("./fileHelpers");
|
|
6
|
+
utils = require("./utils");
|
|
9
7
|
|
|
10
|
-
const
|
|
8
|
+
const uploadSuits = (bsConfig, filePath, opts) => {
|
|
11
9
|
return new Promise(function (resolve, reject) {
|
|
12
|
-
if (
|
|
13
|
-
return resolve({
|
|
10
|
+
if (opts.urlPresent) {
|
|
11
|
+
return resolve({ [opts.md5ReturnKey]: opts.url });
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
url: config.uploadUrl,
|
|
18
|
-
auth: {
|
|
19
|
-
user: bsConfig.auth.username,
|
|
20
|
-
password: bsConfig.auth.access_key
|
|
21
|
-
},
|
|
22
|
-
formData: {
|
|
23
|
-
file: fs.createReadStream(filePath),
|
|
24
|
-
filetype: 'zip',
|
|
25
|
-
filename: 'tests',
|
|
26
|
-
zipMd5sum: md5data.md5sum ? md5data.md5sum : '',
|
|
27
|
-
},
|
|
28
|
-
headers: {
|
|
29
|
-
"User-Agent": utils.getUserAgent(),
|
|
30
|
-
}
|
|
13
|
+
if (!opts.archivePresent) {
|
|
14
|
+
return resolve({});
|
|
31
15
|
}
|
|
32
16
|
|
|
17
|
+
logger.info(opts.messages.uploading);
|
|
18
|
+
|
|
19
|
+
let options = utils.generateUploadParams(bsConfig, filePath, opts.md5Data, opts.fileDetails)
|
|
33
20
|
let responseData = null;
|
|
34
21
|
request.post(options, function (err, resp, body) {
|
|
35
22
|
if (err) {
|
|
@@ -38,23 +25,31 @@ const uploadCypressZip = (bsConfig, filePath, md5data) => {
|
|
|
38
25
|
try {
|
|
39
26
|
responseData = JSON.parse(body);
|
|
40
27
|
} catch (e) {
|
|
41
|
-
responseData =
|
|
28
|
+
responseData = {};
|
|
42
29
|
}
|
|
43
30
|
if (resp.statusCode != 200) {
|
|
31
|
+
if (resp.statusCode == 401) {
|
|
32
|
+
if (responseData && responseData["error"]) {
|
|
33
|
+
return reject(responseData["error"]);
|
|
34
|
+
} else {
|
|
35
|
+
return reject(Constants.validationMessages.INVALID_DEFAULT_AUTH_PARAMS);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (!opts.propogateError){
|
|
39
|
+
return resolve({});
|
|
40
|
+
}
|
|
44
41
|
if(responseData && responseData["error"]){
|
|
45
42
|
reject(responseData["error"]);
|
|
46
43
|
} else {
|
|
47
|
-
if(resp.statusCode ==
|
|
48
|
-
reject(Constants.validationMessages.INVALID_DEFAULT_AUTH_PARAMS);
|
|
49
|
-
} else if (resp.statusCode == 413) {
|
|
44
|
+
if (resp.statusCode == 413) {
|
|
50
45
|
reject(Constants.userMessages.ZIP_UPLOAD_LIMIT_EXCEEDED);
|
|
51
46
|
} else {
|
|
52
47
|
reject(Constants.userMessages.ZIP_UPLOADER_NOT_REACHABLE);
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
50
|
} else {
|
|
56
|
-
logger.info(
|
|
57
|
-
|
|
51
|
+
logger.info(`${opts.messages.uploadingSuccess} (${responseData[opts.md5ReturnKey]})`);
|
|
52
|
+
opts.cleanupMethod();
|
|
58
53
|
resolve(responseData);
|
|
59
54
|
}
|
|
60
55
|
}
|
|
@@ -62,4 +57,21 @@ const uploadCypressZip = (bsConfig, filePath, md5data) => {
|
|
|
62
57
|
});
|
|
63
58
|
}
|
|
64
59
|
|
|
60
|
+
|
|
61
|
+
const uploadCypressZip = (bsConfig, md5data, packageData) => {
|
|
62
|
+
return new Promise(function (resolve, reject) {
|
|
63
|
+
let obj = {}
|
|
64
|
+
const zipOptions = utils.generateUploadOptions('zip', md5data, packageData);
|
|
65
|
+
const npmOptions = utils.generateUploadOptions('npm', md5data, packageData);
|
|
66
|
+
let zipUpload = uploadSuits(bsConfig, config.fileName, zipOptions);
|
|
67
|
+
let npmPackageUpload = uploadSuits(bsConfig, config.packageFileName, npmOptions);
|
|
68
|
+
Promise.all([zipUpload, npmPackageUpload]).then(function (uploads) {
|
|
69
|
+
uploads.forEach(upload => Object.assign(obj, upload))
|
|
70
|
+
return resolve(obj);
|
|
71
|
+
}).catch((error) => {
|
|
72
|
+
return reject(error);
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
exports.zipUpload = uploadCypressZip
|
package/bin/runner.js
CHANGED
|
@@ -164,10 +164,15 @@ var argv = yargs
|
|
|
164
164
|
type: "boolean"
|
|
165
165
|
},
|
|
166
166
|
'sync': {
|
|
167
|
-
default:
|
|
167
|
+
default: true,
|
|
168
168
|
describe: Constants.cliMessages.RUN.SYNC_DESCRIPTION,
|
|
169
169
|
type: "boolean"
|
|
170
170
|
},
|
|
171
|
+
'async': {
|
|
172
|
+
default: false,
|
|
173
|
+
describe: Constants.cliMessages.RUN.ASYNC_DESCRIPTION,
|
|
174
|
+
type: "boolean"
|
|
175
|
+
},
|
|
171
176
|
'force-upload': {
|
|
172
177
|
default: false,
|
|
173
178
|
describe: Constants.cliMessages.COMMON.FORCE_UPLOAD,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserstack-cypress-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,8 +26,10 @@
|
|
|
26
26
|
"uuid": "^8.3.2",
|
|
27
27
|
"winston": "^2.3.1",
|
|
28
28
|
"yargs": "^14.2.3",
|
|
29
|
+
"npm": "^6.14.15",
|
|
29
30
|
"axios": "^0.21.1",
|
|
30
|
-
"unzipper": "^0.10.11"
|
|
31
|
+
"unzipper": "^0.10.11",
|
|
32
|
+
"update-notifier": "^5.1.0"
|
|
31
33
|
},
|
|
32
34
|
"repository": {
|
|
33
35
|
"type": "git",
|