browserstack-cypress-cli 1.31.8 → 1.31.10
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.
|
@@ -5,13 +5,13 @@ const logger = require("../helpers/logger").winstonLogger,
|
|
|
5
5
|
utils = require("../helpers/utils"),
|
|
6
6
|
reporterHTML = require('../helpers/reporterHTML'),
|
|
7
7
|
getInitialDetails = require('../helpers/getInitialDetails').getInitialDetails;
|
|
8
|
-
|
|
8
|
+
const { isTurboScaleSession } = require('../helpers/atsHelper');
|
|
9
9
|
|
|
10
10
|
module.exports = function generateReport(args, rawArgs) {
|
|
11
11
|
let bsConfigPath = utils.getConfigPath(args.cf);
|
|
12
12
|
let reportGenerator = reporterHTML.reportGenerator;
|
|
13
13
|
|
|
14
|
-
return utils.validateBstackJson(bsConfigPath).then(function (bsConfig) {
|
|
14
|
+
return utils.validateBstackJson(bsConfigPath).then(async function (bsConfig) {
|
|
15
15
|
// setting setDefaults to {} if not present and set via env variables or via args.
|
|
16
16
|
utils.setDefaults(bsConfig, args);
|
|
17
17
|
|
|
@@ -21,9 +21,9 @@ module.exports = function generateReport(args, rawArgs) {
|
|
|
21
21
|
// accept the access key from command line if provided
|
|
22
22
|
utils.setAccessKey(bsConfig, args);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
try {
|
|
25
|
+
let buildReportData = isTurboScaleSession(bsConfig) ? null : await getInitialDetails(bsConfig, args, rawArgs);
|
|
26
|
+
utils.setUsageReportingFlag(bsConfig, args.disableUsageReporting);
|
|
27
27
|
|
|
28
28
|
// set cypress config filename
|
|
29
29
|
utils.setCypressConfigFilename(bsConfig, args);
|
|
@@ -34,9 +34,9 @@ module.exports = function generateReport(args, rawArgs) {
|
|
|
34
34
|
|
|
35
35
|
reportGenerator(bsConfig, buildId, args, rawArgs, buildReportData);
|
|
36
36
|
utils.sendUsageReport(bsConfig, args, 'generate-report called', messageType, errorCode, buildReportData, rawArgs);
|
|
37
|
-
}
|
|
37
|
+
} catch(err) {
|
|
38
38
|
logger.warn(err);
|
|
39
|
-
}
|
|
39
|
+
};
|
|
40
40
|
}).catch(function (err) {
|
|
41
41
|
logger.error(err);
|
|
42
42
|
utils.setUsageReportingFlag(null, args.disableUsageReporting);
|
package/bin/commands/runs.js
CHANGED
|
@@ -365,10 +365,10 @@ module.exports = function run(args, rawArgs) {
|
|
|
365
365
|
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
366
366
|
|
|
367
367
|
// download build artifacts
|
|
368
|
-
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE
|
|
368
|
+
if (exitCode != Constants.BUILD_FAILED_EXIT_CODE) {
|
|
369
369
|
if (utils.nonEmptyArray(bsConfig.run_settings.downloads)) {
|
|
370
370
|
logger.debug("Downloading build artifacts");
|
|
371
|
-
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData);
|
|
371
|
+
await downloadBuildArtifacts(bsConfig, data.build_id, args, rawArgs, buildReportData, turboScaleSession);
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
// Generate custom report!
|
|
@@ -35,6 +35,9 @@ const parseAndDownloadArtifacts = async (buildId, data, bsConfig, args, rawArgs,
|
|
|
35
35
|
utils.sendUsageReport(bsConfig, args, warningMessage, Constants.messageTypes.ERROR, 'build_artifacts_not_found', buildReportData, rawArgs);
|
|
36
36
|
} else {
|
|
37
37
|
BUILD_ARTIFACTS_FAIL_COUNT += 1;
|
|
38
|
+
const errorMsg = `Error downloading build artifacts for ${sessionId} with error: ${error}`;
|
|
39
|
+
logger.debug(errorMsg);
|
|
40
|
+
utils.sendUsageReport(bsConfig, args, errorMsg, Constants.messageTypes.ERROR, 'build_artifacts_parse_error', buildReportData, rawArgs);
|
|
38
41
|
}
|
|
39
42
|
// delete malformed zip if present
|
|
40
43
|
let tmpFilePath = path.join(filePath, fileName);
|
|
@@ -102,6 +105,7 @@ const downloadAndUnzip = async (filePath, fileName, url) => {
|
|
|
102
105
|
let tmpFilePath = path.join(filePath, fileName);
|
|
103
106
|
const writer = fs.createWriteStream(tmpFilePath);
|
|
104
107
|
|
|
108
|
+
logger.debug(`Downloading build artifact for: ${filePath}`)
|
|
105
109
|
return new Promise(async (resolve, reject) => {
|
|
106
110
|
request.get(url).on('response', function(response) {
|
|
107
111
|
|
|
@@ -109,7 +113,8 @@ const downloadAndUnzip = async (filePath, fileName, url) => {
|
|
|
109
113
|
if (response.statusCode === 404) {
|
|
110
114
|
reject(Constants.userMessages.DOWNLOAD_BUILD_ARTIFACTS_NOT_FOUND);
|
|
111
115
|
}
|
|
112
|
-
|
|
116
|
+
const errorMsg = `Non 200 status code, got status code: ${response.statusCode}`;
|
|
117
|
+
reject(errorMsg);
|
|
113
118
|
} else {
|
|
114
119
|
//ensure that the user can call `then()` only when the file has
|
|
115
120
|
//been downloaded entirely.
|
|
@@ -208,13 +213,15 @@ const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs, bu
|
|
|
208
213
|
});
|
|
209
214
|
}
|
|
210
215
|
|
|
211
|
-
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null) => {
|
|
216
|
+
exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs, buildReportData = null, isTurboScaleSession = false) => {
|
|
212
217
|
return new Promise ( async (resolve, reject) => {
|
|
213
218
|
BUILD_ARTIFACTS_FAIL_COUNT = 0;
|
|
214
219
|
BUILD_ARTIFACTS_TOTAL_COUNT = 0;
|
|
215
220
|
|
|
216
221
|
let options = {
|
|
217
|
-
url:
|
|
222
|
+
url: isTurboScaleSession
|
|
223
|
+
? `${config.turboScaleBuildsUrl}/${buildId}/build_artifacts`
|
|
224
|
+
: `${config.buildUrl}${buildId}/build_artifacts`,
|
|
218
225
|
auth: {
|
|
219
226
|
username: bsConfig.auth.username,
|
|
220
227
|
password: bsConfig.auth.access_key,
|
|
@@ -131,6 +131,9 @@ const caps = (bsConfig, zip) => {
|
|
|
131
131
|
obj.run_settings = JSON.stringify(bsConfig.run_settings);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
obj.cypress_cli_user_agent = Utils.getUserAgent();
|
|
135
|
+
logger.info(`Cypress CLI User Agent: ${obj.cypress_cli_user_agent}`);
|
|
136
|
+
|
|
134
137
|
if(obj.parallels === Constants.cliMessages.RUN.DEFAULT_PARALLEL_MESSAGE) obj.parallels = undefined
|
|
135
138
|
|
|
136
139
|
if (obj.project) logger.info(`Project name is: ${obj.project}`);
|
|
@@ -6,6 +6,7 @@ const fs = require('fs'),
|
|
|
6
6
|
Constants = require('./constants'),
|
|
7
7
|
config = require("./config"),
|
|
8
8
|
decompress = require('decompress');
|
|
9
|
+
const { isTurboScaleSession } = require('../helpers/atsHelper');
|
|
9
10
|
|
|
10
11
|
let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) => {
|
|
11
12
|
let options = {
|
|
@@ -19,6 +20,10 @@ let reportGenerator = (bsConfig, buildId, args, rawArgs, buildReportData, cb) =>
|
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
if (isTurboScaleSession(bsConfig)) {
|
|
24
|
+
options.url = `${config.turboScaleBuildsUrl}/${buildId}/custom_report`;
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
logger.debug('Started fetching the build json and html reports.');
|
|
23
28
|
|
|
24
29
|
return request.get(options, async function (err, resp, body) {
|