Skip to content

Commit 0bee05b

Browse files
Merge branch 'master' into OB-1893-handle-empty-dependencies
2 parents 9448d3b + b96ba50 commit 0bee05b

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

bin/helpers/utils.js

+6
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,12 @@ exports.setLocalArgs = (bsConfig, args) => {
942942
let local_args = {}
943943
local_args['key'] = bsConfig['auth']['access_key'];
944944
local_args['localIdentifier'] = bsConfig["connection_settings"]["local_identifier"];
945+
if (bsConfig["connection_settings"]["proxyHost"])
946+
local_args['proxyHost'] = bsConfig["connection_settings"]["proxyHost"];
947+
if (bsConfig["connection_settings"]["proxyPort"])
948+
local_args['proxyPort'] = bsConfig["connection_settings"]["proxyPort"];
949+
if (bsConfig["connection_settings"]["useCaCertificate"])
950+
local_args['useCaCertificate'] = bsConfig["connection_settings"]["useCaCertificate"];
945951
local_args['daemon'] = true;
946952
local_args['enable-logging-for-api'] = true
947953
local_args['source'] = `cypress:${usageReporting.cli_version_and_path(bsConfig).version}`;

bin/testObservability/cypress/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
/* Used to detect Gherkin steps */
44
Cypress.on('log:added', (log) => {
5-
cy.now('task', 'test_observability_step', {
6-
log
7-
}, {log: false}).then((res) => {
8-
}).catch((err) => {
9-
});
5+
return () => {
6+
return cy.now('task', 'test_observability_step', {
7+
log
8+
}, {log: false})
9+
}
1010
});
1111

1212
Cypress.on('command:start', (command) => {

bin/testObservability/helper/helper.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,19 @@ exports.getTestEnv = () => {
163163
}
164164

165165
exports.getFileSeparatorData = () => {
166-
const fileSeparatorRegex = /^win/.test(process.platform) ? "\\\\" : "/";
167-
const fileSeparator = /^win/.test(process.platform) ? "\\" : "/";
168-
return {
169-
fileSeparator,
170-
fileSeparatorRegex
171-
};
166+
return /^win/.test(process.platform) ? "\\" : "/";
172167
}
173168

174169
exports.findGitConfig = (filePath) => {
175-
const { fileSeparator, fileSeparatorRegex } = exports.getFileSeparatorData();
170+
const fileSeparator = exports.getFileSeparatorData();
176171
if(filePath == null || filePath == '' || filePath == fileSeparator) {
177172
return null;
178173
}
179174
try {
180175
fs.statSync(filePath + fileSeparator + '.git' + fileSeparator + 'config');
181176
return filePath;
182177
} catch(e) {
183-
let parentFilePath = filePath.split(fileSeparatorRegex);
178+
let parentFilePath = filePath.split(fileSeparator);
184179
parentFilePath.pop();
185180
return exports.findGitConfig(parentFilePath.join(fileSeparator));
186181
}
@@ -1002,7 +997,7 @@ exports.runCypressTestsLocally = (bsConfig, args, rawArgs) => {
1002997
const cypressProcess = spawn(
1003998
'npx',
1004999
['cypress', 'run', ...getReRunSpecs(rawArgs.slice(1)), ...getLocalSessionReporter()],
1005-
{ stdio: 'inherit', cwd: process.cwd(), env: process.env }
1000+
{ stdio: 'inherit', cwd: process.cwd(), env: process.env, shell: true }
10061001
);
10071002
cypressProcess.on('close', async (code) => {
10081003
logger.info(`Cypress process exited with code ${code}`);

bin/testObservability/reporter/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class MyReporter {
284284
if(!isBrowserstackInfra()) gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL ? process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL.toString() : null;
285285
const prefixedTestPath = rootParentFile ? this._paths.prefixTestPath(rootParentFile) : 'File path could not be found';
286286

287-
const { fileSeparator, fileSeparatorRegex } = getFileSeparatorData();
287+
const fileSeparator = getFileSeparatorData();
288288

289289
let testData = {
290290
'framework': 'Cypress',
@@ -309,11 +309,14 @@ class MyReporter {
309309
'failure_type': !failureReason ? null : failureReason.match(/AssertionError/) ? 'AssertionError' : 'UnhandledError',
310310
'retry_of': test.retryOf,
311311
'meta': {
312-
steps: JSON.parse(JSON.stringify(this.currentTestCucumberSteps))
312+
steps: []
313313
}
314314
};
315315

316-
this.currentTestCucumberSteps = [];
316+
if(eventType.match(/TestRunFinished/) || eventType.match(/TestRunSkipped/)) {
317+
testData['meta'].steps = JSON.parse(JSON.stringify(this.currentTestCucumberSteps));
318+
this.currentTestCucumberSteps = [];
319+
}
317320

318321
const { os, os_version } = await getOSDetailsFromSystem(process.env.observability_product);
319322
if(process.env.observability_integration) {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browserstack-cypress-cli",
3-
"version": "1.25.0",
3+
"version": "1.25.2",
44
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
55
"main": "index.js",
66
"scripts": {
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"archiver": "5.3.0",
1616
"async": "3.2.3",
17-
"browserstack-local": "1.5.1",
17+
"browserstack-local": "1.5.4",
1818
"chalk": "4.1.2",
1919
"cli-progress": "3.10.0",
2020
"fs-extra": "8.1.0",

0 commit comments

Comments
 (0)