browserstack-cypress-cli 1.29.1 → 1.29.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/commands/runs.js
CHANGED
|
@@ -263,7 +263,15 @@ module.exports = function run(args, rawArgs) {
|
|
|
263
263
|
|
|
264
264
|
let test_zip_size = utils.fetchZipSize(path.join(process.cwd(), config.fileName));
|
|
265
265
|
let npm_zip_size = utils.fetchZipSize(path.join(process.cwd(), config.packageFileName));
|
|
266
|
-
let node_modules_size = await utils.fetchFolderSize(path.join(process.cwd(), "node_modules"))
|
|
266
|
+
let node_modules_size = await utils.fetchFolderSize(path.join(process.cwd(), "node_modules"));
|
|
267
|
+
|
|
268
|
+
if (Constants.turboScaleObj.enabled) {
|
|
269
|
+
// Note: Calculating md5 here for turboscale force-upload so that we don't need to re-calculate at hub
|
|
270
|
+
let zip_md5sum = await checkUploaded.checkSpecsMd5(bsConfig.run_settings, args, {markBlockStart, markBlockEnd});
|
|
271
|
+
let npm_package_md5sum = await checkUploaded.checkPackageMd5(bsConfig.run_settings);
|
|
272
|
+
Object.assign(md5data, { npm_package_md5sum });
|
|
273
|
+
Object.assign(md5data, { zip_md5sum });
|
|
274
|
+
}
|
|
267
275
|
|
|
268
276
|
//Package diff
|
|
269
277
|
let isPackageDiff = false;
|
|
@@ -13,9 +13,6 @@ const crypto = require('crypto'),
|
|
|
13
13
|
|
|
14
14
|
const checkSpecsMd5 = (runSettings, args, instrumentBlocks) => {
|
|
15
15
|
return new Promise(function (resolve, reject) {
|
|
16
|
-
if (args["force-upload"]) {
|
|
17
|
-
return resolve("force-upload");
|
|
18
|
-
}
|
|
19
16
|
let cypressFolderPath = undefined;
|
|
20
17
|
if (runSettings.home_directory) {
|
|
21
18
|
cypressFolderPath = runSettings.home_directory;
|
|
@@ -166,4 +163,8 @@ const checkUploadedMd5 = (bsConfig, args, instrumentBlocks) => {
|
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
165
|
|
|
169
|
-
exports
|
|
166
|
+
module.exports = {
|
|
167
|
+
checkSpecsMd5,
|
|
168
|
+
checkPackageMd5,
|
|
169
|
+
checkUploadedMd5
|
|
170
|
+
};
|
|
@@ -10,6 +10,7 @@ const config = require('./config'),
|
|
|
10
10
|
utils = require('./utils');
|
|
11
11
|
|
|
12
12
|
const { AUTH_REGEX, REDACTED_AUTH, REDACTED, CLI_ARGS_REGEX, RAW_ARGS_REGEX } = require("./constants");
|
|
13
|
+
const { isTurboScaleSession } = require('../helpers/atsHelper');
|
|
13
14
|
|
|
14
15
|
function get_version(package_name) {
|
|
15
16
|
try {
|
|
@@ -197,10 +198,58 @@ function redactKeys(str, regex, redact) {
|
|
|
197
198
|
return str.replace(regex, redact);
|
|
198
199
|
}
|
|
199
200
|
|
|
201
|
+
function sendTurboscaleErrorLogs(args) {
|
|
202
|
+
let bsConfig = JSON.parse(JSON.stringify(args.bstack_config));
|
|
203
|
+
let data = utils.isUndefined(args.data) ? {} : args.data;
|
|
204
|
+
const turboscaleErrorPayload = {
|
|
205
|
+
kind: 'hst-cypress-cli-error',
|
|
206
|
+
data: data,
|
|
207
|
+
error: args.message
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const options = {
|
|
211
|
+
headers: {
|
|
212
|
+
'User-Agent': utils.getUserAgent()
|
|
213
|
+
},
|
|
214
|
+
method: "POST",
|
|
215
|
+
auth: {
|
|
216
|
+
username: bsConfig.auth.username,
|
|
217
|
+
password: bsConfig.auth.access_key,
|
|
218
|
+
},
|
|
219
|
+
url: `${config.turboScaleAPIUrl}/send-instrumentation`,
|
|
220
|
+
body: turboscaleErrorPayload,
|
|
221
|
+
json: true,
|
|
222
|
+
maxAttempts: 10, // (default) try 3 times
|
|
223
|
+
retryDelay: 2000, // (default) wait for 2s before trying again
|
|
224
|
+
retrySrategy: request.RetryStrategies.HTTPOrNetworkError, // (default) retry on 5xx or network errors
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
fileLogger.info(`Sending ${JSON.stringify(turboscaleErrorPayload)} to ${config.turboScaleAPIUrl}/send-instrumentation`);
|
|
228
|
+
request(options, function (error, res, body) {
|
|
229
|
+
if (error) {
|
|
230
|
+
//write err response to file
|
|
231
|
+
fileLogger.error(JSON.stringify(error));
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
// write response file
|
|
235
|
+
let response = {
|
|
236
|
+
attempts: res.attempts,
|
|
237
|
+
statusCode: res.statusCode,
|
|
238
|
+
body: body
|
|
239
|
+
};
|
|
240
|
+
fileLogger.info(`${JSON.stringify(response)}`);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
200
244
|
function send(args) {
|
|
245
|
+
let bsConfig = JSON.parse(JSON.stringify(args.bstack_config));
|
|
246
|
+
|
|
247
|
+
if (isTurboScaleSession(bsConfig) && args.message_type === 'error') {
|
|
248
|
+
sendTurboscaleErrorLogs(args);
|
|
249
|
+
}
|
|
250
|
+
|
|
201
251
|
if (isUsageReportingEnabled() === "true") return;
|
|
202
252
|
|
|
203
|
-
let bsConfig = JSON.parse(JSON.stringify(args.bstack_config));
|
|
204
253
|
let runSettings = "";
|
|
205
254
|
let sanitizedbsConfig = "";
|
|
206
255
|
let cli_details = cli_version_and_path(bsConfig);
|
|
@@ -258,6 +307,10 @@ function send(args) {
|
|
|
258
307
|
},
|
|
259
308
|
};
|
|
260
309
|
|
|
310
|
+
if (isTurboScaleSession(bsConfig)) {
|
|
311
|
+
payload.event_type = 'hst_cypress_cli_stats';
|
|
312
|
+
}
|
|
313
|
+
|
|
261
314
|
const options = {
|
|
262
315
|
headers: {
|
|
263
316
|
"Content-Type": "text/json",
|