browserstack-cypress-cli 1.25.1 → 1.25.3
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.
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/* Used to detect Gherkin steps */
|
|
4
4
|
Cypress.on('log:added', (log) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
5
|
+
return () => {
|
|
6
|
+
return cy.now('task', 'test_observability_step', {
|
|
7
|
+
log
|
|
8
|
+
}, {log: false})
|
|
9
|
+
}
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
Cypress.on('command:start', (command) => {
|
|
@@ -163,16 +163,11 @@ exports.getTestEnv = () => {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
exports.getFileSeparatorData = () => {
|
|
166
|
-
|
|
167
|
-
const fileSeparator = /^win/.test(process.platform) ? "\\" : "/";
|
|
168
|
-
return {
|
|
169
|
-
fileSeparator,
|
|
170
|
-
fileSeparatorRegex
|
|
171
|
-
};
|
|
166
|
+
return /^win/.test(process.platform) ? "\\" : "/";
|
|
172
167
|
}
|
|
173
168
|
|
|
174
169
|
exports.findGitConfig = (filePath) => {
|
|
175
|
-
const
|
|
170
|
+
const fileSeparator = exports.getFileSeparatorData();
|
|
176
171
|
if(filePath == null || filePath == '' || filePath == fileSeparator) {
|
|
177
172
|
return null;
|
|
178
173
|
}
|
|
@@ -180,7 +175,7 @@ exports.findGitConfig = (filePath) => {
|
|
|
180
175
|
fs.statSync(filePath + fileSeparator + '.git' + fileSeparator + 'config');
|
|
181
176
|
return filePath;
|
|
182
177
|
} catch(e) {
|
|
183
|
-
let parentFilePath = filePath.split(
|
|
178
|
+
let parentFilePath = filePath.split(fileSeparator);
|
|
184
179
|
parentFilePath.pop();
|
|
185
180
|
return exports.findGitConfig(parentFilePath.join(fileSeparator));
|
|
186
181
|
}
|
|
@@ -197,32 +192,41 @@ const getGitMetaData = () => {
|
|
|
197
192
|
if(!info.author && exports.findGitConfig(process.cwd())) {
|
|
198
193
|
/* commit objects are packed */
|
|
199
194
|
gitLastCommit.getLastCommit(async (err, commit) => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
195
|
+
if(err) {
|
|
196
|
+
exports.debug(`Exception in populating Git Metadata with error : ${err}`, true, err);
|
|
197
|
+
return resolve({});
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
info["author"] = info["author"] || `${commit["author"]["name"].replace(/[“]+/g, '')} <${commit["author"]["email"].replace(/[“]+/g, '')}>`;
|
|
201
|
+
info["authorDate"] = info["authorDate"] || commit["authoredOn"];
|
|
202
|
+
info["committer"] = info["committer"] || `${commit["committer"]["name"].replace(/[“]+/g, '')} <${commit["committer"]["email"].replace(/[“]+/g, '')}>`;
|
|
203
|
+
info["committerDate"] = info["committerDate"] || commit["committedOn"];
|
|
204
|
+
info["commitMessage"] = info["commitMessage"] || commit["subject"];
|
|
205
|
+
|
|
206
|
+
const { remote } = await pGitconfig(info.commonGitDir);
|
|
207
|
+
const remotes = Object.keys(remote).map(remoteName => ({name: remoteName, url: remote[remoteName]['url']}));
|
|
208
|
+
resolve({
|
|
209
|
+
"name": "git",
|
|
210
|
+
"sha": info["sha"],
|
|
211
|
+
"short_sha": info["abbreviatedSha"],
|
|
212
|
+
"branch": info["branch"],
|
|
213
|
+
"tag": info["tag"],
|
|
214
|
+
"committer": info["committer"],
|
|
215
|
+
"committer_date": info["committerDate"],
|
|
216
|
+
"author": info["author"],
|
|
217
|
+
"author_date": info["authorDate"],
|
|
218
|
+
"commit_message": info["commitMessage"],
|
|
219
|
+
"root": info["root"],
|
|
220
|
+
"common_git_dir": info["commonGitDir"],
|
|
221
|
+
"worktree_git_dir": info["worktreeGitDir"],
|
|
222
|
+
"last_tag": info["lastTag"],
|
|
223
|
+
"commits_since_last_tag": info["commitsSinceLastTag"],
|
|
224
|
+
"remotes": remotes
|
|
225
|
+
});
|
|
226
|
+
} catch(e) {
|
|
227
|
+
exports.debug(`Exception in populating Git Metadata with error : ${e}`, true, e);
|
|
228
|
+
return resolve({});
|
|
229
|
+
}
|
|
226
230
|
}, {dst: exports.findGitConfig(process.cwd())});
|
|
227
231
|
} else {
|
|
228
232
|
const { remote } = await pGitconfig(info.commonGitDir);
|
|
@@ -475,7 +479,6 @@ const getBuildDetails = (bsConfig) => {
|
|
|
475
479
|
const setBrowserstackCypressCliDependency = (bsConfig) => {
|
|
476
480
|
const runSettings = bsConfig.run_settings;
|
|
477
481
|
if (runSettings.npm_dependencies !== undefined &&
|
|
478
|
-
Object.keys(runSettings.npm_dependencies).length !== 0 &&
|
|
479
482
|
typeof runSettings.npm_dependencies === 'object') {
|
|
480
483
|
if (!("browserstack-cypress-cli" in runSettings.npm_dependencies)) {
|
|
481
484
|
logger.warn("Missing browserstack-cypress-cli not found in npm_dependencies");
|
|
@@ -588,7 +591,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
|
|
|
588
591
|
exports.debug('Build creation successfull!');
|
|
589
592
|
process.env.BS_TESTOPS_BUILD_COMPLETED = true;
|
|
590
593
|
setEnvironmentVariablesForRemoteReporter(response.data.jwt, response.data.build_hashed_id, response.data.allow_screenshots, data.observability_version.sdkVersion);
|
|
591
|
-
setEventListeners();
|
|
594
|
+
// setEventListeners();
|
|
592
595
|
if(this.isBrowserstackInfra()) setBrowserstackCypressCliDependency(user_config);
|
|
593
596
|
} catch(error) {
|
|
594
597
|
if(!error.errorType) {
|
|
@@ -1003,7 +1006,7 @@ exports.runCypressTestsLocally = (bsConfig, args, rawArgs) => {
|
|
|
1003
1006
|
const cypressProcess = spawn(
|
|
1004
1007
|
'npx',
|
|
1005
1008
|
['cypress', 'run', ...getReRunSpecs(rawArgs.slice(1)), ...getLocalSessionReporter()],
|
|
1006
|
-
{ stdio: 'inherit', cwd: process.cwd(), env: process.env }
|
|
1009
|
+
{ stdio: 'inherit', cwd: process.cwd(), env: process.env, shell: true }
|
|
1007
1010
|
);
|
|
1008
1011
|
cypressProcess.on('close', async (code) => {
|
|
1009
1012
|
logger.info(`Cypress process exited with code ${code}`);
|
|
@@ -284,7 +284,7 @@ class MyReporter {
|
|
|
284
284
|
if(!isBrowserstackInfra()) gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL ? process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL.toString() : null;
|
|
285
285
|
const prefixedTestPath = rootParentFile ? this._paths.prefixTestPath(rootParentFile) : 'File path could not be found';
|
|
286
286
|
|
|
287
|
-
const
|
|
287
|
+
const fileSeparator = getFileSeparatorData();
|
|
288
288
|
|
|
289
289
|
let testData = {
|
|
290
290
|
'framework': 'Cypress',
|
|
@@ -309,11 +309,14 @@ class MyReporter {
|
|
|
309
309
|
'failure_type': !failureReason ? null : failureReason.match(/AssertionError/) ? 'AssertionError' : 'UnhandledError',
|
|
310
310
|
'retry_of': test.retryOf,
|
|
311
311
|
'meta': {
|
|
312
|
-
steps:
|
|
312
|
+
steps: []
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
if(eventType.match(/TestRunFinished/) || eventType.match(/TestRunSkipped/)) {
|
|
317
|
+
testData['meta'].steps = JSON.parse(JSON.stringify(this.currentTestCucumberSteps));
|
|
318
|
+
this.currentTestCucumberSteps = [];
|
|
319
|
+
}
|
|
317
320
|
|
|
318
321
|
const { os, os_version } = await getOSDetailsFromSystem(process.env.observability_product);
|
|
319
322
|
if(process.env.observability_integration) {
|
package/package.json
CHANGED
package/log/usage.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"level":"info","message":"Sending {\"event_type\":\"cypress_cli_stats\",\"data\":{\"bstack_json\":\"null\",\"run_settings\":\"\",\"os\":\"darwin\",\"os_version\":\"21.6.0\",\"bstack_json_found_in_pwd\":false,\"cypress_config_file_found_in_pwd\":null,\"cli_version\":\"1.24.4\",\"cli_path\":\"/Users/archish/.nvm/versions/node/v16.16.0/lib/node_modules\",\"npm_version\":\"8.11.0\",\"local_cypress_version\":null,\"ci_environment\":null,\"event_timestamp\":\"7/27/2023, 4:39:59 PM\",\"data\":null,\"raw_args\":\"[\\\"run\\\",\\\"--async\\\"]\",\"cli_args\":\"{\\\"_\\\":[\\\"run\\\"],\\\"async\\\":true,\\\"cf\\\":\\\"browserstack.json\\\",\\\"config-file\\\":\\\"browserstack.json\\\",\\\"configFile\\\":\\\"browserstack.json\\\",\\\"cli-debug\\\":false,\\\"cliDebug\\\":false,\\\"ccf\\\":\\\"./cypress.json\\\",\\\"cypress-config-file\\\":\\\"./cypress.json\\\",\\\"cypressConfigFile\\\":\\\"./cypress.json\\\",\\\"disable-npm-warning\\\":false,\\\"disableNpmWarning\\\":false,\\\"sync\\\":true,\\\"force-upload\\\":false,\\\"forceUpload\\\":false,\\\"headed\\\":false,\\\"no-wrap\\\":false,\\\"noWrap\\\":false,\\\"$0\\\":\\\"browserstack-cypress\\\"}\",\"message_type\":\"error\",\"error_code\":\"bstack_json_invalid_unknown\"}} to https://eds.browserstack.com:443/send_event_cy_internal","timestamp":"2023-07-27T11:09:59.626Z"}
|