Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browserstack-cypress-cli

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserstack-cypress-cli - npm Package Compare versions

Comparing version 1.26.2 to 1.27.0

bin/helpers/runnerArgs.js

18

bin/commands/runs.js

@@ -114,3 +114,6 @@ 'use strict';

*/
if(isTestObservabilitySession) await launchTestSession(bsConfig, bsConfigPath);
if(isTestObservabilitySession) {
await launchTestSession(bsConfig, bsConfigPath);
utils.setO11yProcessHooks(null, bsConfig, args, null, buildReportData);
}

@@ -190,3 +193,3 @@ // accept the system env list from bsconf and set it

bsConfig['run_settings']['video_config'] = utils.getVideoConfig(cypressConfigFile);
bsConfig['run_settings']['video_config'] = utils.getVideoConfig(cypressConfigFile, bsConfig);

@@ -253,2 +256,10 @@ // return the number of parallels user specified

}
// Set config args for enforce_settings
if ( !utils.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) ) {
markBlockStart('setEnforceSettingsConfig');
logger.debug('Started setting the configs');
utils.setEnforceSettingsConfig(bsConfig);
logger.debug('Completed setting the configs');
markBlockEnd('setEnforceSettingsConfig');
}
// Create build

@@ -270,2 +281,5 @@ //setup Local Testing

utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
if(isTestObservabilitySession) {
utils.setO11yProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
}
let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`;

@@ -272,0 +286,0 @@ let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`;

@@ -187,2 +187,6 @@ const fs = require('fs'),

if ( bsConfig && bsConfig.run_settings && bsConfig.run_settings.enforce_settings && bsConfig.run_settings.enforce_settings.toString() === 'true' && Utils.isUndefined(bsConfig.run_settings.specs) ) {
reject(Constants.validationMessages.EMPTY_SPECS_IN_BROWSERSTACK_JSON);
}
// validate parallels specified in browserstack.json if parallels are not specified via arguments

@@ -218,3 +222,4 @@ if (!Utils.isUndefined(args) && Utils.isUndefined(args.parallels) && !Utils.isParallelValid(bsConfig.run_settings.parallels)) reject(Constants.validationMessages.INVALID_PARALLELS_CONFIGURATION);

try {
if (bsConfig.run_settings.cypress_config_filename !== 'false') {
// Not reading cypress config file upon enforce_settings
if (Utils.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && bsConfig.run_settings.cypress_config_filename !== 'false') {
if (bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE) {

@@ -239,2 +244,7 @@ const completeCypressConfigFile = readCypressConfigFile(bsConfig)

}
else {
logger.debug("Validating baseurl and integrationFolder in browserstack.json");
if (!Utils.isUndefined(bsConfig.run_settings.baseUrl) && bsConfig.run_settings.baseUrl.includes("localhost") && !Utils.getLocalFlag(bsConfig.connection_settings)) reject(Constants.validationMessages.LOCAL_NOT_SET.replace("<baseUrlValue>", bsConfig.run_settings.baseUrl));
if (!Utils.isUndefined(bsConfig.run_settings.integrationFolder) && !Utils.isCypressProjDirValid(bsConfig.run_settings.cypressProjectDir,bsConfig.run_settings.integrationFolder)) reject(Constants.validationMessages.INCORRECT_DIRECTORY_STRUCTURE);
}
} catch(error){

@@ -241,0 +251,0 @@ reject(Constants.validationMessages.INVALID_CYPRESS_JSON)

@@ -75,2 +75,4 @@ let config = require("./config");

"Skipping zip upload since BrowserStack already has your test suite that has not changed since the last run.",
SKIP_NPM_INSTALL:
"Skipping NPM Install as the enforce_settings has been passed.",
SKIP_UPLOADING_NPM_PACKAGES:

@@ -138,4 +140,6 @@ "Skipping the upload of node_modules since BrowserStack has already cached your npm dependencies that have not changed since the last run.",

"cypress_config_file is not set in run_settings. See https://www.browserstack.com/docs/automate/cypress/configuration-file to learn more.",
EMPTY_SPECS_IN_BROWSERSTACK_JSON:
"specs is required when enforce_settings is true in run_settings of browserstack.json",
VALIDATED: "browserstack.json file is validated",
NOT_VALID: "browerstack.json is not valid",
NOT_VALID: "browserstack.json is not valid",
NOT_VALID_JSON: "browerstack.json is not a valid json",

@@ -142,0 +146,0 @@ INVALID_EXTENSION: "Invalid files, please remove these files and try again.",

@@ -136,3 +136,7 @@ 'use strict';

};
if (bsConfig && bsConfig.run_settings && bsConfig.run_settings.enforce_settings && bsConfig.run_settings.enforce_settings.toString() === 'true' ) {
logger.info("Enforce_settings is enabled in run_settings");
logger.debug(Constants.userMessages.SKIP_NPM_INSTALL);
return resolve(obj);
}
logger.info(Constants.userMessages.NPM_INSTALL);

@@ -139,0 +143,0 @@ instrumentBlocks.markBlockStart("packageInstaller.folderSetup");

@@ -25,3 +25,3 @@ "use strict";

transports = require('./logger').transports,
{ findGitConfig, printBuildLink, isTestObservabilitySession, isBrowserstackInfra, shouldReRunObservabilityTests } = require('../testObservability/helper/helper'),
o11yHelpers = require('../testObservability/helper/helper'),
{ OBSERVABILITY_ENV_VARS, TEST_OBSERVABILITY_REPORTER } = require('../testObservability/helper/constants');

@@ -438,3 +438,4 @@

} else {
if (!this.isUndefined(cypressConfigFile) && !this.isUndefined(cypressConfigFile["projectId"])) {
// ignore reading cypressconfig if enforce_settings is passed
if (this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && !this.isUndefined(cypressConfigFile) && !this.isUndefined(cypressConfigFile["projectId"])) {
return cypressConfigFile["projectId"];

@@ -485,3 +486,3 @@ }

exports.setUserSpecs = (bsConfig, args) => {
if(isBrowserstackInfra() && isTestObservabilitySession() && shouldReRunObservabilityTests()) {
if(o11yHelpers.isBrowserstackInfra() && o11yHelpers.isTestObservabilitySession() && o11yHelpers.shouldReRunObservabilityTests()) {
bsConfig.run_settings.specs = process.env.BROWSERSTACK_RERUN_TESTS;

@@ -586,4 +587,4 @@ return;

let gitConfigPath = findGitConfig(process.cwd());
if(!isBrowserstackInfra()) process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL = gitConfigPath;
let gitConfigPath = o11yHelpers.findGitConfig(process.cwd());
if(!o11yHelpers.isBrowserstackInfra()) process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL = gitConfigPath;
if(gitConfigPath) {

@@ -635,2 +636,4 @@ const relativePathFromGitConfig = path.relative(gitConfigPath, process.cwd());

exports.isUndefinedOrFalse = value => ( this.isUndefined(value) || value.toString().toLowerCase() === 'false');
exports.isFloat = (value) => Number(value) && Number(value) % 1 !== 0;

@@ -1085,3 +1088,4 @@

testFolderPath = defaultSpecFolder
if(!this.isUndefined(cypressConfig) && !this.isUndefined(cypressConfig.e2e)) {
// Read cypress config if enforce_settings is not present
if(this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) && !this.isUndefined(cypressConfig) && !this.isUndefined(cypressConfig.e2e)) {
if(!this.isUndefined(cypressConfig.e2e.specPattern)) {

@@ -1193,4 +1197,4 @@ globCypressConfigSpecPatterns = Array.isArray(cypressConfig.e2e.specPattern) ?

}
if(isTestObservabilitySession()) {
printBuildLink(true, exitCode);
if(o11yHelpers.isTestObservabilitySession()) {
o11yHelpers.printBuildLink(true, exitCode);
} else {

@@ -1296,5 +1300,49 @@ process.exit(exitCode);

exports.setVideoCliConfig = (bsConfig, videoConfig) => {
// set cli config for video for cypress 13 and above to attain default value of true.
if(this.isUndefined(videoConfig) || this.isUndefined(videoConfig.video) || this.isUndefined(videoConfig.videoUploadOnPasses) || this.isUndefined(bsConfig)) return;
let user_cypress_version = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.cypress_version) ? bsConfig.run_settings.cypress_version.toString() : undefined;
let cypress_major_version = (user_cypress_version && user_cypress_version.match(/^(\d+)/)) ? user_cypress_version.split(".")[0] : undefined;
let config_args = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.config) ? bsConfig.run_settings.config : undefined;
if(this.isUndefined(user_cypress_version) || this.isUndefined(cypress_major_version) || parseInt(cypress_major_version) >= 13 ) {
let video_args = `video=${videoConfig.video},videoUploadOnPasses=${videoConfig.videoUploadOnPasses}`;
config_args = this.isUndefined(config_args) ? video_args : config_args + ',' + video_args;
logger.debug(`Setting default video true for cypress 13 and above in cli for cypress version ${user_cypress_version} with cli args - ${config_args}`)
}
if (bsConfig.run_settings && this.isNotUndefined(config_args)) bsConfig["run_settings"]["config"] = config_args;
}
// set configs if enforce_settings is passed
exports.setEnforceSettingsConfig = (bsConfig) => {
if ( this.isUndefined(bsConfig) || this.isUndefined(bsConfig.run_settings) ) return;
let config_args = (bsConfig && bsConfig.run_settings && bsConfig.run_settings.config) ? bsConfig.run_settings.config : undefined;
if ( this.isUndefined(config_args) || !config_args.includes("video") ) {
let video_args = (this.isUndefined(bsConfig.run_settings.video_config) || this.isUndefined(bsConfig.run_settings.video_config.video) || !bsConfig.run_settings.video_config.video ) ? 'video=false' : 'video=true' ;
video_args += (this.isUndefined(bsConfig.run_settings.video_config) || this.isUndefined(bsConfig.run_settings.video_config.videoUploadOnPasses) || !bsConfig.run_settings.video_config.videoUploadOnPasses ) ? ',videoUploadOnPasses=false' : ',videoUploadOnPasses=true';
config_args = this.isUndefined(config_args) ? video_args : config_args + ',' + video_args;
logger.debug(`Setting video_args for enforce_settings to ${video_args}`);
}
if ( (bsConfig && bsConfig.run_settings && bsConfig.run_settings.baseUrl) && (this.isUndefined(config_args) || !config_args.includes("baseUrl")) ) {
let base_url_args = 'baseUrl='+bsConfig.run_settings.baseUrl;
config_args = this.isUndefined(config_args) ? base_url_args : config_args + ',' + base_url_args;
logger.debug(`Setting base_url_args for enforce_settings to ${base_url_args}`);
}
// set specs in config of specpattern to override cypress config
if( this.isNotUndefined(bsConfig.run_settings.specs) && bsConfig.run_settings.cypressTestSuiteType === Constants.CYPRESS_V10_AND_ABOVE_TYPE && (this.isUndefined(config_args) || !config_args.includes("specPattern")) ) {
// doing this only for cypress 10 and above as --spec is given precedence for cypress 9.
let specConfigs = bsConfig.run_settings.specs;
// if multiple specs are passed, convert it into an array.
if(specConfigs && specConfigs.includes(',')) {
specConfigs = JSON.stringify(specConfigs.split(','));
}
let spec_pattern_args = 'specPattern="'+specConfigs+'"';
config_args = this.isUndefined(config_args) ? spec_pattern_args : config_args + ',' + spec_pattern_args;
}
if ( this.isNotUndefined(config_args) ) bsConfig["run_settings"]["config"] = config_args;
logger.debug(`Setting conifg_args for enforce_settings to ${config_args}`);
}
// blindly send other passed configs with run_settings and handle at backend
exports.setOtherConfigs = (bsConfig, args) => {
if(isTestObservabilitySession() && process.env.BS_TESTOPS_JWT) {
if(o11yHelpers.isTestObservabilitySession() && process.env.BS_TESTOPS_JWT) {
bsConfig["run_settings"]["reporter"] = TEST_OBSERVABILITY_REPORTER;

@@ -1464,2 +1512,17 @@ return;

exports.setO11yProcessHooks = (() => {
let bindData = {};
let handlerAdded = false;
return (buildId, bsConfig, bsLocal, args, buildReportData) => {
bindData.buildId = buildId;
bindData.bsConfig = bsConfig;
bindData.bsLocal = bsLocal;
bindData.args = args;
bindData.buildReportData = buildReportData;
if (handlerAdded) return;
handlerAdded = true;
process.on('beforeExit', processO11yExitHandler.bind(this, bindData));
}
})()
async function processExitHandler(exitData){

@@ -1469,6 +1532,14 @@ logger.warn(Constants.userMessages.PROCESS_KILL_MESSAGE);

await this.stopLocalBinary(exitData.bsConfig, exitData.bsLocalInstance, exitData.args, null, exitData.buildReportData);
await printBuildLink(true);
await o11yHelpers.printBuildLink(true);
process.exit(0);
}
async function processO11yExitHandler(exitData){
if (exitData.buildId) {
await o11yHelpers.printBuildLink(false);
} else {
await o11yHelpers.printBuildLink(true);
}
}
exports.fetchZipSize = (fileName) => {

@@ -1512,3 +1583,3 @@ try {

exports.getVideoConfig = (cypressConfig) => {
exports.getVideoConfig = (cypressConfig, bsConfig = {}) => {
let conf = {

@@ -1518,5 +1589,14 @@ video: true,

}
if (!this.isUndefined(cypressConfig.video)) conf.video = cypressConfig.video;
if (!this.isUndefined(cypressConfig.videoUploadOnPasses)) conf.videoUploadOnPasses = cypressConfig.videoUploadOnPasses;
// Reading bsconfig in case of enforce_settings
if ( this.isUndefined(bsConfig.run_settings) || this.isUndefinedOrFalse(bsConfig.run_settings.enforce_settings) ) {
if (!this.isUndefined(cypressConfig.video)) conf.video = cypressConfig.video;
if (!this.isUndefined(cypressConfig.videoUploadOnPasses)) conf.videoUploadOnPasses = cypressConfig.videoUploadOnPasses;
}
else {
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.video)) conf.video = bsConfig.run_settings.video;
if (!this.isUndefined(bsConfig.run_settings) && !this.isUndefined(bsConfig.run_settings.videoUploadOnPasses)) conf.videoUploadOnPasses = bsConfig.run_settings.videoUploadOnPasses;
}
// set video in cli config in case of cypress 13 or above as default value is false there.
this.setVideoCliConfig(bsConfig,conf);
logger.debug(`Setting video = ${conf.video}`);

@@ -1523,0 +1603,0 @@ logger.debug(`Setting videoUploadOnPasses = ${conf.videoUploadOnPasses}`);

203

bin/runner.js

@@ -5,59 +5,6 @@ #!/usr/bin/env node

logger = require("./helpers/logger").winstonLogger,
Constants = require('./helpers/constants');
Constants = require('./helpers/constants'),
{ disableUsageReportingOptions, commonBuildOptions, runOptions } = require('./helpers/runnerArgs');
const disableUsageReportingOptions = {
'disable-usage-reporting': {
default: undefined,
description: Constants.cliMessages.COMMON.DISABLE_USAGE_REPORTING,
type: "boolean"
},
}
const usernameOptions = {
'u': {
alias: 'username',
describe: Constants.cliMessages.COMMON.USERNAME,
type: "string",
default: undefined
},
}
const accessKeyOptions = {
'k': {
alias: 'key',
describe: Constants.cliMessages.COMMON.ACCESS_KEY,
type: "string",
default: undefined
},
}
const configFileOptions = {
'cf': {
alias: 'config-file',
describe: Constants.cliMessages.COMMON.CONFIG_FILE_PATH,
default: 'browserstack.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.COMMON.CONFIG_DEMAND
},
}
const debugModeOptions = {
'cli-debug': {
default: false,
describe: Constants.cliMessages.COMMON.DEBUG,
type: "boolean"
},
}
const commonBuildOptions = {
...configFileOptions,
...disableUsageReportingOptions,
...usernameOptions,
...accessKeyOptions,
...debugModeOptions,
}
function checkCommands(yargs, argv, numRequired) {

@@ -136,147 +83,3 @@ if (argv._.length < numRequired) {

.options({
...commonBuildOptions,
'ccf': {
alias: 'cypress-config-file',
describe: Constants.cliMessages.RUN.CYPRESS_DESC,
default: './cypress.json',
type: 'string',
nargs: 1,
demand: true,
demand: Constants.cliMessages.RUN.CYPRESS_CONFIG_DEMAND
},
'gl': {
alias: 'geolocation',
describe: Constants.cliMessages.RUN.CYPRESS_GEO_LOCATION,
default: undefined,
type: 'string'
},
'p': {
alias: ['parallels', 'parallel'],
describe: Constants.cliMessages.RUN.PARALLEL_DESC,
type: "number",
default: undefined
},
'b': {
alias: ['build-name', 'ci-build-id'],
describe: Constants.cliMessages.RUN.BUILD_NAME,
type: "string",
default: undefined
},
'e': {
alias: 'exclude',
describe: Constants.cliMessages.RUN.EXCLUDE,
type: "string",
default: undefined
},
's': {
alias: ['specs', 'spec'],
describe: Constants.cliMessages.RUN.SPECS_DESCRIPTION,
type: "string",
default: undefined
},
'env': {
describe: Constants.cliMessages.RUN.ENV_DESCRIPTION,
type: "string",
default: undefined
},
't': {
alias: ['specTimeout'],
default: undefined,
describe: Constants.cliMessages.RUN.SPEC_TIMEOUT,
type: "string"
},
'disable-npm-warning': {
default: false,
description: Constants.cliMessages.COMMON.NO_NPM_WARNING,
type: "boolean"
},
'sync': {
default: true,
describe: Constants.cliMessages.RUN.SYNC_DESCRIPTION,
type: "boolean"
},
'async': {
default: false,
describe: Constants.cliMessages.RUN.ASYNC_DESCRIPTION,
type: "boolean"
},
'force-upload': {
default: false,
describe: Constants.cliMessages.COMMON.FORCE_UPLOAD,
type: "boolean"
},
'headed': {
default: false,
describe: Constants.cliMessages.RUN.HEADED,
type: "boolean"
},
'local': {
describe: Constants.cliMessages.RUN.LOCAL,
type: "boolean"
},
'local-identifier': {
describe: Constants.cliMessages.RUN.LOCAL_IDENTIFIER,
type: "string"
},
'local-mode': {
describe: Constants.cliMessages.RUN.LOCAL_MODE,
type: "string"
},
'local-config-file': {
describe: Constants.cliMessages.RUN.LOCAL_CONFIG_FILE,
type: "string"
},
'no-wrap': {
default: false,
describe: Constants.cliMessages.RUN.SYNC_NO_WRAP,
type: "boolean"
},
'browser': {
describe: Constants.cliMessages.RUN.BROWSER_DESCRIPTION,
type: "string",
default: undefined
},
'c': {
alias: 'config',
describe: Constants.cliMessages.RUN.CONFIG_DESCRIPTION,
type: "string",
default: undefined
},
'r': {
alias: 'reporter',
default: undefined,
describe: Constants.cliMessages.RUN.REPORTER,
type: "string"
},
'o': {
alias: 'reporter-options',
default: undefined,
describe: Constants.cliMessages.RUN.REPORTER_OPTIONS,
type: "string"
},
'record': {
describe: Constants.cliMessages.RUN.RECORD,
type: "boolean"
},
'record-key': {
default: undefined,
describe: Constants.cliMessages.RUN.RECORD_KEY,
type: "string"
},
'projectId': {
default: undefined,
describe: Constants.cliMessages.RUN.PROJECT_ID,
type: "string"
},
'nv': {
alias: ['node-version', 'nodeVersion'],
default: undefined,
describe: Constants.cliMessages.RUN.NODE_VERSION,
type: "string"
},
'build-tag': {
default: undefined,
describe: Constants.cliMessages.RUN.BUILD_TAG,
type: "string"
}
...runOptions,
})

@@ -283,0 +86,0 @@ .help('help')

@@ -12,2 +12,3 @@ const fs = require('fs');

const glob = require('glob');
const { runOptions } = require('../../helpers/runnerArgs')

@@ -68,4 +69,7 @@ const pGitconfig = promisify(gitconfig);

exports.buildStopped = false;
exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
if(!this.isTestObservabilitySession()) return;
if(!this.isTestObservabilitySession() || exports.buildStopped) return;
exports.buildStopped = true;
try {

@@ -771,9 +775,41 @@ if(shouldStopSession) {

const cleanupTestObservabilityFlags = (rawArgs) => {
const newRawArgs = [];
for(let idx=0; idx<rawArgs.length; idx++) {
if(!['--disable-browserstack-automation', '--disable-test-observability'].includes(rawArgs[idx])) {
newRawArgs.push(rawArgs[idx]);
const newArgs = [];
const aliasMap = Object.keys(runOptions).reduce( (acc, key) => {
const curr = runOptions[key];
if (curr.alias) {
const aliases = Array.isArray(curr.alias) ? curr.alias : [curr.alias]
for (const alias of aliases) {
acc[alias] = curr;
}
}
return acc;
}, {})
const cliArgs = {
...runOptions,
...aliasMap
}
return newRawArgs;
// these flags are present in cypress too, but in some the same cli and
// cypress flags have different meaning. In that case, we assume user has
// given cypress related args
const retain = ['c', 'p', 'b', 'o', 's', 'specs', 'spec']
for (let i = 0;i < rawArgs.length;i++) {
const arg = rawArgs[i];
if (arg.startsWith('-')) {
const argName = arg.length > 1 && arg[1] == '-' ? arg.slice(2) : arg.slice(1);
// If this flag belongs to cli, we omit it and its value
if (cliArgs[argName] && !retain.includes(argName)) {
const nextArg = i + 1 < rawArgs.length ? rawArgs[i+1] : ''
// if the flag is bound to have a value, we ignore it
if (cliArgs[argName].type && cliArgs[argName].type !== 'boolean' && !nextArg.startsWith('-')) {
i++;
}
continue;
}
}
newArgs.push(rawArgs[i]);
}
return newArgs;
}

@@ -780,0 +816,0 @@

@@ -74,2 +74,3 @@ 'use strict';

this.currentTestCucumberSteps = [];
this.hooksStarted = {};
this.beforeHooks = [];

@@ -114,2 +115,5 @@ this.platformDetailsMap = {};

}
// Remove hooks added at hook start
delete this.hooksStarted[hook.hookAnalyticsId];
await this.sendTestRunEvent(hook,undefined,false,"HookRunFinished");

@@ -157,2 +161,3 @@ }

.on(EVENT_TEST_BEGIN, async (test) => {
if (test.isSkipped) return;
if(this.testObservability == true) {

@@ -164,2 +169,3 @@ await this.testStarted(test);

.on(EVENT_TEST_END, async (test) => {
if (test.isSkipped) return;
if(this.testObservability == true) {

@@ -442,2 +448,34 @@ if(!this.runStatusMarkedHash[test.testAnalyticsId]) {

}
// Add started hooks to the hash
if(eventType === 'HookRunStarted' && ['BEFORE_EACH', 'AFTER_EACH', 'BEFORE_ALL'].includes(testData['hook_type'])) {
this.hooksStarted[testData.uuid] = uploadData;
}
// Send pending hook finsihed events for hook starts
if (eventType === 'TestRunFinished') {
Object.values(this.hooksStarted).forEach(async hookData => {
hookData['event_type'] = 'HookRunFinished';
hookData['hook_run'] = {
...hookData['hook_run'],
result: uploadData['test_run'].result,
failure: uploadData['test_run'].failure,
failure_type: uploadData['test_run'].failure_type,
failure_reason: uploadData['test_run'].failure_reason,
failure_reason_expanded: uploadData['test_run'].failure_reason_expanded,
failure_backtrace: uploadData['test_run'].failure_backtrace
}
if (hookData['hook_run']['hook_type'] === 'BEFORE_ALL') {
hookData['hook_run'].finished_at = uploadData['test_run'].finished_at;
hookData['hook_run'].duration_in_ms = new Date(hookData['hook_run'].finished_at).getTime() - new Date(hookData['hook_run'].started_at).getTime();
} else {
hookData['hook_run'].finished_at = hookData['hook_run'].started_at;
hookData['hook_run'].duration_in_ms = 0;
}
await uploadEventData(hookData);
})
this.hooksStarted = {};
}
} catch(error) {

@@ -444,0 +482,0 @@ debug(`Exception in populating test data for event ${eventType} with error : ${error}`, true, error);

{
"name": "browserstack-cypress-cli",
"version": "1.26.2",
"version": "1.27.0",
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc