browserstack-node-sdk 1.62.0 → 1.63.0
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/ats/src/cloudproviders/AWS.js +1 -1
- package/ats/src/cloudproviders/Azure.js +1 -1
- package/ats/src/cloudproviders/CloudProvider.js +1 -1
- package/ats/src/cloudproviders/GoogleCloudProvider.js +1 -1
- package/ats/src/cloudproviders/utils.js +1 -1
- package/ats/src/commands/configure.js +1 -1
- package/ats/src/commands/connect.js +1 -1
- package/ats/src/commands/connect_commands/grid.js +1 -1
- package/ats/src/commands/create.js +1 -1
- package/ats/src/commands/create_commands/grid.js +1 -1
- package/ats/src/commands/delete.js +1 -1
- package/ats/src/commands/delete_commands/grid.js +1 -1
- package/ats/src/commands/init.js +1 -1
- package/ats/src/commands/list.js +1 -1
- package/ats/src/commands/list_commands/grid_profiles.js +1 -1
- package/ats/src/commands/list_commands/grids.js +1 -1
- package/ats/src/commands/precheck.js +1 -1
- package/ats/src/commands/precheck_commands/setup_precheck.js +1 -1
- package/ats/src/commands/start.js +1 -1
- package/ats/src/commands/start_commands/grid.js +1 -1
- package/ats/src/commands/stop.js +1 -1
- package/ats/src/commands/stop_commands/grid.js +1 -1
- package/ats/src/config/constants.js +1 -1
- package/ats/src/config/logger.js +1 -1
- package/ats/src/index.js +1 -1
- package/ats/src/utils/AWSUtils.js +1 -1
- package/ats/src/utils/createAutoscalerStack.js +1 -1
- package/ats/src/utils/createClusterStack.js +1 -1
- package/ats/src/utils/createHubHaStack.js +1 -1
- package/ats/src/utils/createk8sClient.js +1 -1
- package/ats/src/utils/deleteEFSMountTargets.js +1 -1
- package/ats/src/utils/deleteStack.js +1 -1
- package/ats/src/utils/describeStack.js +1 -1
- package/ats/src/utils/gridComponents.js +1 -1
- package/ats/src/utils/hstUtils.js +1 -1
- package/ats/src/utils/instrumentationUtils.js +1 -1
- package/ats/src/utils/userInput.js +1 -1
- package/ats/src/utils/utilityMethods.js +1 -1
- package/ats/src/utils/webSocketUtils.js +1 -1
- package/package.json +1 -1
- package/src/ai-sdk-node/bundle.js +1 -1
- package/src/bin/codeceptjs/BrowserStackPlugin.js +1 -1
- package/src/bin/codeceptjs/command.js +1 -1
- package/src/bin/codeceptjs/helper.js +1 -1
- package/src/bin/codeceptjs/o11yHelper.js +1 -1
- package/src/bin/cucumber-js/command.js +1 -1
- package/src/bin/cucumber-js/formatter/custom_formatter.js +1 -1
- package/src/bin/cucumber-js/formatter/custom_formatter_old_versions.js +1 -1
- package/src/bin/cucumber-js/test-observability.js +1 -1
- package/src/bin/cucumber-js/test.setup.js +1 -1
- package/src/bin/cucumber-js/test_old.setup.js +1 -1
- package/src/bin/cucumber-js/timeout.setup.js +1 -1
- package/src/bin/integrations/command.js +1 -1
- package/src/bin/integrations/constants.js +1 -1
- package/src/bin/jasmine/bstack-reporter/customReporter.js +1 -1
- package/src/bin/jasmine/command.js +1 -1
- package/src/bin/jasmine/test.setup.js +1 -1
- package/src/bin/jasmine/testRunMap.js +1 -1
- package/src/bin/jest/command.js +1 -1
- package/src/bin/jest/customImplements/customCircus.js +1 -1
- package/src/bin/jest/customImplements/customEnvironment.js +1 -1
- package/src/bin/jest/customImplements/customJestAdapterInit.js +1 -1
- package/src/bin/jest/customImplements/customSequencer.js +1 -1
- package/src/bin/jest/customImplements/customTestRunnerTemplate.js +1 -1
- package/src/bin/jest/jest.setup.js +1 -1
- package/src/bin/jest/test-observability/data-hooks.js +1 -1
- package/src/bin/jest/test-observability/helper.js +1 -1
- package/src/bin/jest/test-observability/obsReporter.js +1 -1
- package/src/bin/jest/test-observability/test-details.js +1 -1
- package/src/bin/jest/test.setup.js +1 -1
- package/src/bin/jest/test_before.setup.js +1 -1
- package/src/bin/launcher/launcher.js +1 -1
- package/src/bin/load/index.js +1 -1
- package/src/bin/load/load/index.js +193 -12
- package/src/bin/load/load/loadErrors.js +248 -0
- package/src/bin/load/loadErrors.js +1 -0
- package/src/bin/load/loadUtils.js +1 -1
- package/src/bin/mocha/accessibility-automation/helper.js +1 -1
- package/src/bin/mocha/bstack-reporter/customReporter.js +1 -1
- package/src/bin/mocha/command.js +1 -1
- package/src/bin/mocha/test-observability/builderPatch.js +1 -1
- package/src/bin/mocha/test-observability/data-hooks.js +1 -1
- package/src/bin/mocha/test-observability/mochaUtils.js +1 -1
- package/src/bin/mocha/test.setup.js +1 -1
- package/src/bin/newman/command.js +1 -1
- package/src/bin/newman/helper.js +1 -1
- package/src/bin/newman/reporter/index.js +1 -1
- package/src/bin/newman/scriptRunner.js +1 -1
- package/src/bin/nightwatch/command.js +1 -1
- package/src/bin/playwright/accessibility-helper.js +1 -1
- package/src/bin/playwright/command.js +1 -1
- package/src/bin/playwright/globalSetup.js +1 -1
- package/src/bin/playwright/mock-process.js +1 -1
- package/src/bin/playwright/modifyPlaywrightConf.js +1 -1
- package/src/bin/playwright/patches.js +1 -1
- package/src/bin/playwright/reporter/pwUtils.js +1 -1
- package/src/bin/playwright/reporter/reporter.js +1 -1
- package/src/bin/playwright/reporter/test-details.js +1 -1
- package/src/bin/playwright/sessionDetails.js +1 -1
- package/src/bin/puppeteer/patches.js +1 -1
- package/src/bin/puppeteer/sessionDetails.js +1 -1
- package/src/bin/puppeteer/test.setup.js +1 -1
- package/src/bin/runner.js +1 -1
- package/src/bin/setup.js +1 -1
- package/src/bin/test-runner/index.js +1 -1
- package/src/bin/test-runner/runTest.js +1 -1
- package/src/bin/test-runner/testWorker.js +1 -1
- package/src/bin/testcafe/a11y-runner.js +1 -1
- package/src/bin/testcafe/command.js +1 -1
- package/src/bin/testcafe/reporter/index.js +1 -1
- package/src/bin/testcafe/reporter/tcUtils.js +1 -1
- package/src/bin/testcafe/session-registry.js +1 -1
- package/src/bin/testcafe/stdout-interceptor.js +1 -1
- package/src/bin/testcafe/testcafe-action-patcher.js +1 -1
- package/src/bin/testcafe/w3c-driver.js +1 -1
- package/src/bin/utils/apiUtilityMethods.js +1 -1
- package/src/bin/utils/clientTroubleshootingService.js +1 -1
- package/src/bin/utils/constants.js +1 -1
- package/src/bin/utils/log4jsAppender.js +1 -1
- package/src/bin/utils/logPatcher.js +1 -1
- package/src/bin/utils/logReportingAPI.js +1 -1
- package/src/bin/utils/playwright-patcher.js +1 -1
- package/src/bin/utils/puppeteer-patcher.js +1 -1
- package/src/bin/utils/sharedPlaywrightSessionDetails.js +1 -1
- package/src/bin/utils/sharedUtils.js +1 -1
- package/src/bin/v2/TestInfo.js +1 -1
- package/src/bin/v2/browserstackCLI.js +1 -1
- package/src/bin/v2/cliUtils.js +1 -1
- package/src/bin/v2/customTagManager.js +1 -1
- package/src/bin/v2/eventDispatcher.js +1 -1
- package/src/bin/v2/framework/automationFramework.js +1 -1
- package/src/bin/v2/framework/constants/automationFrameworkConstants.js +1 -1
- package/src/bin/v2/framework/constants/testFrameworkConstants.js +1 -1
- package/src/bin/v2/framework/cucumberTestFramework.js +1 -1
- package/src/bin/v2/framework/jestTestFramework.js +1 -1
- package/src/bin/v2/framework/newmanTestFramework.js +1 -1
- package/src/bin/v2/framework/playwrightAutomationFramework.js +1 -1
- package/src/bin/v2/framework/playwrightTestFramework.js +1 -1
- package/src/bin/v2/framework/puppeteerAutomationFramework.js +1 -1
- package/src/bin/v2/framework/testFramework.js +1 -1
- package/src/bin/v2/framework/testcafeAutomationFramework.js +1 -1
- package/src/bin/v2/framework/testcafeTestFramework.js +1 -1
- package/src/bin/v2/grpcClient.js +1 -1
- package/src/bin/v2/instances/automationFrameworkInstance.js +1 -1
- package/src/bin/v2/instances/testFrameworkInstance.js +1 -1
- package/src/bin/v2/instances/trackedContext.js +1 -1
- package/src/bin/v2/instances/trackedInstance.js +1 -1
- package/src/bin/v2/modules/accessibilityModule.js +1 -1
- package/src/bin/v2/modules/baseModule.js +1 -1
- package/src/bin/v2/modules/loadTestModule.js +1 -1
- package/src/bin/v2/modules/observabilityModule.js +1 -1
- package/src/bin/v2/modules/playwrightDriverModule.js +1 -1
- package/src/bin/v2/modules/puppeteerDriverModule.js +1 -1
- package/src/bin/v2/modules/testcafeDriverModule.js +1 -1
- package/src/bin/v2/modules/testhubModule.js +1 -1
- package/src/bin/v2/sdkErrorHandler.js +1 -0
- package/src/bin/v2/state/automationFrameworkState.js +1 -1
- package/src/bin/v2/state/hookState.js +1 -1
- package/src/bin/v2/state/testFrameworkState.js +1 -1
- package/src/bin/v2/uploadAttachmentsManager.js +1 -1
- package/src/bin/v2/utils/cucumber-utils.js +1 -1
- package/src/bin/v2/utils/jest-utils.js +1 -1
- package/src/bin/vanilla-js/command.js +1 -1
- package/src/browserStackSdk.js +1 -1
- package/src/helpers/BrowserStackSetup.js +1 -1
- package/src/helpers/accessibility-automation/accessibilityRetryHelper.js +1 -1
- package/src/helpers/accessibility-automation/constants.js +1 -1
- package/src/helpers/accessibility-automation/helper.js +1 -1
- package/src/helpers/accessibility-automation/scripts.js +1 -1
- package/src/helpers/ai-sdk/aiSdkWrapper.js +1 -1
- package/src/helpers/ai-sdk/autoHealHelper.js +1 -1
- package/src/helpers/ats/constants.js +1 -1
- package/src/helpers/ats/helper.js +1 -1
- package/src/helpers/caCertHelper.js +1 -1
- package/src/helpers/capsMapping.js +1 -1
- package/src/helpers/central-scanner/constants.js +1 -1
- package/src/helpers/central-scanner/helpers.js +1 -1
- package/src/helpers/classLogger.js +1 -1
- package/src/helpers/driverInitErrorReporter.js +1 -1
- package/src/helpers/globals.js +1 -1
- package/src/helpers/helper.js +1 -1
- package/src/helpers/logger.js +1 -1
- package/src/helpers/metadata.js +1 -1
- package/src/helpers/patchHelper.js +1 -1
- package/src/helpers/patchHelpers.js +1 -1
- package/src/helpers/percy/Percy.js +1 -1
- package/src/helpers/percy/PercyBinary.js +1 -1
- package/src/helpers/percy/PercyCaptureMap.js +1 -1
- package/src/helpers/percy/PercyCaptureModes.js +1 -1
- package/src/helpers/percy/PercySDK.js +1 -1
- package/src/helpers/percy/index.js +1 -1
- package/src/helpers/percy/utils.js +1 -1
- package/src/helpers/performance/constants.js +1 -1
- package/src/helpers/performance/performance-tester.js +1 -1
- package/src/helpers/playwright-helper.js +1 -1
- package/src/helpers/processHelper.js +1 -1
- package/src/helpers/puppeteer-helper.js +1 -1
- package/src/helpers/request-spy.js +1 -1
- package/src/helpers/setKeepAlive.js +1 -1
- package/src/helpers/stackFrameUtils.js +1 -1
- package/src/helpers/test-observability/constants.js +1 -1
- package/src/helpers/test-observability/error-handler.js +1 -1
- package/src/helpers/test-observability/requestQueueHandler.js +1 -1
- package/src/helpers/test-observability/sessionHandler.js +1 -1
- package/src/helpers/test-observability/utils.js +1 -1
- package/src/helpers/test-orchestration/constants.js +1 -1
- package/src/helpers/test-orchestration/failfastManager.js +1 -1
- package/src/helpers/test-orchestration/fileHelper.js +1 -1
- package/src/helpers/test-orchestration/orchestrationUtils.js +1 -1
- package/src/helpers/test-orchestration/requestUtils.js +1 -1
- package/src/helpers/test-orchestration/testOrchestrationHandler.js +1 -1
- package/src/helpers/test-orchestration/testOrderingServerHandler.js +1 -1
- package/src/helpers/testhub/constants.js +1 -1
- package/src/helpers/testhub/testhubHandler.js +1 -1
- package/src/helpers/testhub/utils.js +1 -1
- package/src/helpers/timeoutPromise.js +1 -1
- package/src/helpers/utilities.js +1 -1
- package/src/helpers/w3cMapping.js +1 -1
- package/src/hubAllocationMethods.js +1 -1
- package/src/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function a31_0x34cd(_0x167c1,_0x3120d8){const _0xc22932=a31_0xc229();return a31_0x34cd=function(_0x34cd78,_0x3263ed){_0x34cd78=_0x34cd78-0x8d;let _0x50e322=_0xc22932[_0x34cd78];return _0x50e322;},a31_0x34cd(_0x167c1,_0x3120d8);}const a31_0x1ae0e5=a31_0x34cd;function a31_0xc229(){const _0x179c87=['../../helpers/test-observability/utils','testSuites','288472wpKFNv','__platform__','../utils/constants','_mochaOpts','580667gHJYhT','testsErrorMessage','AI_ENABLED_FRAMEWORK','testsPending','../utils/clientTroubleshootingService','testsFailed','formatter','2850IeTvPB','8288400zmJevj','RGfKG','configuration','_bsConfig','setupCucumber','totalTests','framework','_framework','../../helpers/performance/constants','path','4257690gtKRyv','55840weEQDb','testsPassed','../../helpers/test-observability/requestQueueHandler','_configuration','7081557PxahlB','platformCaps','setFramework','testsUndefined','testSuitesFailed','13110leUZsW','mochaOpts','setConfig','platform','_capability','../../helpers/helper','RXswh','capability','testsAmbiguous'];a31_0xc229=function(){return _0x179c87;};return a31_0xc229();}(function(_0x325d2b,_0x2820a8){const _0x2eb772=a31_0x34cd,_0x3a9f79=_0x325d2b();while(!![]){try{const _0x5c0ce1=parseInt(_0x2eb772(0xa0))/0x1+parseInt(_0x2eb772(0x9c))/0x2+parseInt(_0x2eb772(0xb2))/0x3+-parseInt(_0x2eb772(0xb3))/0x4+-parseInt(_0x2eb772(0xa7))/0x5*(parseInt(_0x2eb772(0x91))/0x6)+-parseInt(_0x2eb772(0xb7))/0x7+parseInt(_0x2eb772(0xa8))/0x8;if(_0x5c0ce1===_0x2820a8)break;else _0x3a9f79['push'](_0x3a9f79['shift']());}catch(_0x4ed95a){_0x3a9f79['push'](_0x3a9f79['shift']());}}}(a31_0xc229,0xddf42));const path=require(a31_0x1ae0e5(0xb1)),{requireModule,modifyCommand,getPlatformName,cleanupDrivers,isBrowserstackInfra}=require(a31_0x1ae0e5(0x96)),constants=require(a31_0x1ae0e5(0x9e)),{isAccessibilityAutomationSession}=require('../../helpers/accessibility-automation/helper'),RequestQueueHandler=require(a31_0x1ae0e5(0xb5)),{isTestObservabilitySession}=require(a31_0x1ae0e5(0x9a)),helper=require(a31_0x1ae0e5(0x96)),PerformanceTester=require('../../helpers/performance/performance-tester'),PerformanceEvents=require(a31_0x1ae0e5(0xb0))['EVENTS'],{commandRepository}=require('../../helpers/ai-sdk/autoHealHelper'),BrowserstackCLI=require('../v2/browserstackCLI'),ClientTroubleShootingService=require(a31_0x1ae0e5(0xa4));class Launcher{constructor(_0x147ee2,_0x33cfbb,_0x4c7147,_0x3a39ed=[]){const _0x7fca98=a31_0x1ae0e5,_0x15400b={'RXswh':'7|14|17|3|20|16|13|21|6|9|11|0|12|2|19|5|1|4|18|22|10|8|23|15','rbTDr':function(_0x4efd7c){return _0x4efd7c();},'RGfKG':function(_0x2c1bbc){return _0x2c1bbc();}},_0x577aa9=_0x15400b[_0x7fca98(0x97)]['split']('|');let _0x39894a=0x0;while(!![]){switch(_0x577aa9[_0x39894a++]){case'0':global['__platformCaps']=this[_0x7fca98(0xb6)][_0x7fca98(0x8d)]||{};continue;case'1':global[_0x7fca98(0xa3)]=0x0;continue;case'2':global[_0x7fca98(0xad)]=0x0;continue;case'3':this[_0x7fca98(0x9f)]=_0x33cfbb[_0x7fca98(0x92)];continue;case'4':global['testsSkipped']=0x0;continue;case'5':global[_0x7fca98(0xa5)]=0x0;continue;case'6':this[_0x7fca98(0xab)]=_0x4c7147;continue;case'7':this[_0x7fca98(0xaf)]=_0x147ee2;continue;case'8':global[_0x7fca98(0x99)]=0x0;continue;case'9':this['_testObservability']=_0x15400b['rbTDr'](isTestObservabilitySession);continue;case'10':global['testsUnknown']=0x0;continue;case'11':this['_accessibilityAutomation']=_0x15400b[_0x7fca98(0xa9)](isAccessibilityAutomationSession);continue;case'12':global[_0x7fca98(0x9b)]=0x0;continue;case'13':global[_0x7fca98(0x9d)]=this[_0x7fca98(0xb6)][_0x7fca98(0x94)];continue;case'14':this[_0x7fca98(0xb6)]=_0x33cfbb[_0x7fca98(0xaa)]||{};continue;case'15':!constants[_0x7fca98(0xa2)]['includes'](_0x147ee2)&&(commandRepository[_0x7fca98(0x93)](_0x4c7147),commandRepository[_0x7fca98(0x8e)](_0x147ee2));continue;case'16':this[_0x7fca98(0x95)]=this['_configuration'][_0x7fca98(0x98)];continue;case'17':this[_0x7fca98(0xb6)][_0x7fca98(0xae)]=_0x147ee2;continue;case'18':global[_0x7fca98(0x90)]=0x0;continue;case'19':global[_0x7fca98(0xb4)]=0x0;continue;case'20':this['_formatter']=_0x33cfbb[_0x7fca98(0xa6)];continue;case'21':this['_argv']=_0x3a39ed;continue;case'22':global[_0x7fca98(0x8f)]=0x0;continue;case'23':global[_0x7fca98(0xa1)]={};continue;}break;}}[a31_0x1ae0e5(0xac)](_0x437b6a,_0xca14e7,_0x14bfcd){const _0x46a9e0=_0x437b6a['resolvePaths'];_0x437b6a.resolvePaths=async function(){const pathResults=await _0x46a9e0.apply(this,arguments);if(!pathResults.requirePaths){pathResults.requirePaths=[];}pathResults.requirePaths=[path.join(__dirname,'../cucumber-js/test.setup.js')].concat(pathResults.requirePaths,path.join(__dirname,_0x14bfcd));return pathResults;};const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;_0xca14e7.push('--format'),_0xca14e7.push(`"${normalizedPath}"`);}run(){return new Promise(async(resolve,reject)=>{PerformanceTester.start(PerformanceEvents.SDK_PRE_TEST);require('../../helpers/setKeepAlive')();if(this._framework==='mocha'){const mochaRunHelper=requireModule('mocha/lib/cli/run-helpers.js','mocha');const Mocha=requireModule('mocha');if(isBrowserstackInfra()){modifyCommand();}const mochaHooks=require('../mocha/test.setup').mochaHooks;if(!helper.isUndefined(this._mochaOpts.mochaRequire)){this._mochaOpts.require=this._mochaOpts.mochaRequire;const plugins=await mochaRunHelper.handleRequires([this._mochaOpts.require]);Object.assign(this._mochaOpts,plugins);}const rootHooks={beforeAll:[mochaHooks.beforeAll],beforeEach:[mochaHooks.beforeEach],afterAll:[mochaHooks.afterAll],afterEach:[mochaHooks.afterEach]};if(isTestObservabilitySession()){const mochaObservabilityHooks=require('../mocha/test-observability/data-hooks').mochaHooks;rootHooks.beforeAll.unshift(mochaObservabilityHooks.beforeAll);rootHooks.afterAll.push(mochaObservabilityHooks.afterAll);}if(this._mochaOpts.rootHooks){this._mochaOpts.rootHooks.beforeAll&&rootHooks.beforeAll.unshift(...this._mochaOpts.rootHooks.beforeAll);this._mochaOpts.rootHooks.beforeEach&&rootHooks.beforeEach.unshift(...this._mochaOpts.rootHooks.beforeEach);this._mochaOpts.rootHooks.afterAll&&rootHooks.afterAll.push(...this._mochaOpts.rootHooks.afterAll);this._mochaOpts.rootHooks.afterEach&&rootHooks.afterEach.push(...this._mochaOpts.rootHooks.afterEach);}const userReporter=this._mochaOpts.reporter;let mochaTimeout=this._mochaOpts.timeout*1;if(this._mochaOpts.timeout===0){mochaTimeout=0;}else{mochaTimeout+=constants.BSTACK_DELTA;}const mochaOpts={};Object.assign(mochaOpts,this._mochaOpts);const reporterOption={};Object.assign(reporterOption,this._mochaOpts.reporterOptions);Object.assign(reporterOption,{type:userReporter||'spec',testObservability:this._testObservability,bsConfig:this._bsConfig});mochaOpts.reporterOption=reporterOption;Object.assign(mochaOpts,{reporter:path.join(__dirname,'../mocha/bstack-reporter/customReporter.js'),parallel:false,rootHooks,isWorker:true,timeout:mochaTimeout});global.browserstackPlatformIndex=helper.nestedKeyValue(this._configuration,['platformIndex']);global.browserstackPercyBestPlatform=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','browserstackPercyBestPlatform']);global.percy=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','percy']);global.percyCaptureMode=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','percyCaptureMode']);global.capabilities=[this._capability];if(helper.isBrowserstackInfra()){if(this._bsConfig.testContextOptions.skipSessionName){global.__skipSessionName=true;}if(this._bsConfig.testContextOptions.skipSessionStatus){global.__skipSessionStatus=true;}}else{global.__skipSessionName=true;global.__skipSessionStatus=true;}if(this._bsConfig.turboScaleUrl){this._configuration.turboScaleUrl=this._bsConfig.turboScaleUrl;}const mocha=new Mocha(mochaOpts);mocha.prevRun=mocha.run;if(isTestObservabilitySession()){mocha.run=function(_){return mocha.prevRun(exit=>{const checkPendingUploadsInterval=setInterval(async()=>{PerformanceTester.start(PerformanceEvents.SDK_POST_TEST);if(RequestQueueHandler.getInstance().pendingUploads<=0){clearInterval(checkPendingUploadsInterval);await cleanupDrivers(global.__driversArray);resolve(exit);}},1000);});};}else{mocha.run=function(_){return mocha.prevRun(async exit=>{PerformanceTester.start(PerformanceEvents.SDK_POST_TEST);await cleanupDrivers(global.__driversArray);resolve(exit);});};}try{require('../../index').browserstackAgentV2(this._configuration,null,this._testObservability);}catch{}PerformanceTester.end(PerformanceEvents.SDK_PRE_TEST);const runProm=mochaRunHelper.runMocha(mocha,mochaOpts);runProm&&runProm.catch(er=>{reject(er);});}else if(this._framework==='cucumber-js'){let cucumberCli;global.capabilities=[this._capability];try{cucumberCli=requireModule('@cucumber/cucumber/lib/cli/index.js','@cucumber/cucumber');}catch(e){cucumberCli=requireModule('cucumber/lib/cli/index.js','cucumber');}const argv=this._argv;const index=argv.indexOf('cucumber-js');if(index>-1){argv.splice(index,1);}const timeoutFileName='../cucumber-js/timeout.setup.js';let paths;try{paths=requireModule('@cucumber/cucumber/lib/paths/paths.js','@cucumber/cucumber');this.setupCucumber(paths,argv,timeoutFileName);}catch(e){try{paths=requireModule('@cucumber/cucumber/lib/api/paths.js','@cucumber/cucumber');this.setupCucumber(paths,argv,timeoutFileName);}catch(e){let hookFileName='../cucumber-js/test.setup.js';let ConfigurationBuilder;try{ConfigurationBuilder=requireModule('@cucumber/cucumber/lib/cli/configuration_builder.js','@cucumber/cucumber').default;const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;argv.push('--format');argv.push(normalizedPath);}catch(e){ConfigurationBuilder=requireModule('cucumber/lib/cli/configuration_builder.js','cucumber').default;const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter_old_versions.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;argv.push('--format');argv.push(normalizedPath);hookFileName='../cucumber-js/test_old.setup.js';}const configBuilder=ConfigurationBuilder.prototype.build;ConfigurationBuilder.prototype.build=async function(){const builderHash=await configBuilder.call(this);builderHash.supportCodePaths.unshift(path.join(__dirname,hookFileName));builderHash.supportCodePaths.push(path.join(__dirname,timeoutFileName));return builderHash;};}}argv.push('--parallel');argv.push(`${this._configuration.maxWorkers}`);if(this._formatter&&this._formatter.length>0){for(let i=0;i<this._formatter.length;i++){const r=getPlatformName(this._capability).replace(/ /g,'_');if(this._formatter[i]!==undefined&&this._formatter[i].length>0){const formatterFinalOutputFileName=this._formatter[i][1];const formatterType=`${this._formatter[i][0]}`;if(formatterFinalOutputFileName!==undefined){const formatterOutputFile=`tmp/${r}${path.extname(formatterFinalOutputFileName)}`;argv.push('--format');argv.push(`${formatterType}:${formatterOutputFile}`);}else{argv.push('--format');argv.push(`${formatterType}:tmp/${r}`);}}}}const cucumber=new cucumberCli.default({argv:argv,cwd:process.cwd(),stdout:process.stdout,stderr:process.stderr,env:process.env});process.env.CONFIG=JSON.stringify(this._configuration);process.env.BSTACK_CONFIG=JSON.stringify(this._bsConfig);cucumber.run().then(async output=>{const _results={scenarios:global.testSuites,steps:global.totalTests,scenariosFailed:global.testSuitesFailed,stepsFailed:global.testsFailed,stepsPassed:global.testsPassed,stepsSkipped:global.testsSkipped,stepsPending:global.testsPending,stepsUndefined:global.testsUndefined,stepsUnknown:global.testsUnknown,stepsAmbiguous:global.testsAmbiguous,processSuccess:output.success,testsErrorMessage:global.testsErrorMessage};await RequestQueueHandler.getInstance().shutdown();resolve(_results);}).catch(async er=>{await RequestQueueHandler.getInstance().shutdown();reject(er);});}else if(this._framework==='vanilla'){global.capabilities=[this._capability];process.argv=this._configuration.args;try{modifyCommand();require('../../index').browserstackAgent(this._configuration);let i=0;process.on('beforeExit',async()=>{if(i>0){return;}i++;await cleanupDrivers(global.__driversArray);});require(this._configuration.file);}catch(er){console.error(er);await BrowserstackCLI.getInstance().stop();process.exitCode=1;reject(er);}resolve();}});}}module.exports=Launcher;
|
|
1
|
+
const a31_0x4ad1e1=a31_0x416f;function a31_0x10ab(){const _0x1a95cd=['_bsConfig','../../helpers/test-observability/requestQueueHandler','bCZEV','9wsVNhr','__platform__','testsErrorMessage','1104621ezHcXP','formatter','../../helpers/test-observability/utils','setConfig','3155446aVOkFO','3407344rDwJci','89754wlmAlH','../../helpers/performance/performance-tester','AI_ENABLED_FRAMEWORK','../../helpers/performance/constants','testsAmbiguous','path','platformCaps','_capability','_framework','../utils/clientTroubleshootingService','testsPassed','testSuites','132540XTTgrZ','totalTests','172PqEovU','testSuitesFailed','../utils/constants','testsFailed','5smbKTS','testsPending','2110224SlURBF','__platformCaps','configuration','_configuration','setupCucumber','jZJVE','split','5303hVEgsF','EVENTS','testsSkipped','../../helpers/accessibility-automation/helper','../../helpers/ai-sdk/autoHealHelper','_mochaOpts','includes','platform','mochaOpts','../../helpers/helper','17|8|10|14|7|6|18|9|16|3|5|21|12|1|22|15|19|13|2|0|20|11|23|4','testsUndefined'];a31_0x10ab=function(){return _0x1a95cd;};return a31_0x10ab();}(function(_0x9df088,_0x1d190f){const _0x4f2853=a31_0x416f,_0x4359bd=_0x9df088();while(!![]){try{const _0x351409=-parseInt(_0x4f2853(0xe3))/0x1*(-parseInt(_0x4f2853(0xd6))/0x2)+parseInt(_0x4f2853(0xc2))/0x3+-parseInt(_0x4f2853(0xdc))/0x4+parseInt(_0x4f2853(0xda))/0x5*(-parseInt(_0x4f2853(0xc8))/0x6)+-parseInt(_0x4f2853(0xc6))/0x7+-parseInt(_0x4f2853(0xc7))/0x8*(-parseInt(_0x4f2853(0xbf))/0x9)+parseInt(_0x4f2853(0xd4))/0xa;if(_0x351409===_0x1d190f)break;else _0x4359bd['push'](_0x4359bd['shift']());}catch(_0xf577ab){_0x4359bd['push'](_0x4359bd['shift']());}}}(a31_0x10ab,0x41f40));const path=require(a31_0x4ad1e1(0xcd)),{requireModule,modifyCommand,getPlatformName,cleanupDrivers,isBrowserstackInfra}=require(a31_0x4ad1e1(0xec)),constants=require(a31_0x4ad1e1(0xd8)),{isAccessibilityAutomationSession}=require(a31_0x4ad1e1(0xe6)),RequestQueueHandler=require(a31_0x4ad1e1(0xbd)),{isTestObservabilitySession}=require(a31_0x4ad1e1(0xc4)),helper=require('../../helpers/helper'),PerformanceTester=require(a31_0x4ad1e1(0xc9)),PerformanceEvents=require(a31_0x4ad1e1(0xcb))[a31_0x4ad1e1(0xe4)],{commandRepository}=require(a31_0x4ad1e1(0xe7)),BrowserstackCLI=require('../v2/browserstackCLI'),ClientTroubleShootingService=require(a31_0x4ad1e1(0xd1));function a31_0x416f(_0x4d4495,_0x40d251){const _0x10ab75=a31_0x10ab();return a31_0x416f=function(_0x416f5e,_0x1bb2c9){_0x416f5e=_0x416f5e-0xbb;let _0xf189ec=_0x10ab75[_0x416f5e];return _0xf189ec;},a31_0x416f(_0x4d4495,_0x40d251);}class Launcher{constructor(_0x165e99,_0x44c6c4,_0x54f0bf,_0x670a4d=[]){const _0x5cf3b8=a31_0x4ad1e1,_0x593ac0={'jZJVE':_0x5cf3b8(0xed),'bCZEV':function(_0x5edfdd){return _0x5edfdd();}},_0x52f427=_0x593ac0[_0x5cf3b8(0xe1)][_0x5cf3b8(0xe2)]('|');let _0x540dc2=0x0;while(!![]){switch(_0x52f427[_0x540dc2++]){case'0':global[_0x5cf3b8(0xbb)]=0x0;continue;case'1':global[_0x5cf3b8(0xd5)]=0x0;continue;case'2':global[_0x5cf3b8(0xd7)]=0x0;continue;case'3':this['_testObservability']=_0x593ac0[_0x5cf3b8(0xbe)](isTestObservabilitySession);continue;case'4':!constants[_0x5cf3b8(0xca)][_0x5cf3b8(0xe9)](_0x165e99)&&(commandRepository[_0x5cf3b8(0xc5)](_0x54f0bf),commandRepository['setFramework'](_0x165e99));continue;case'5':this['_accessibilityAutomation']=_0x593ac0[_0x5cf3b8(0xbe)](isAccessibilityAutomationSession);continue;case'6':this[_0x5cf3b8(0xcf)]=this['_configuration']['capability'];continue;case'7':this['_formatter']=_0x44c6c4[_0x5cf3b8(0xc3)];continue;case'8':this[_0x5cf3b8(0xdf)]=_0x44c6c4[_0x5cf3b8(0xde)]||{};continue;case'9':this['_argv']=_0x670a4d;continue;case'10':this[_0x5cf3b8(0xdf)]['framework']=_0x165e99;continue;case'11':global[_0x5cf3b8(0xcc)]=0x0;continue;case'12':global[_0x5cf3b8(0xd3)]=0x0;continue;case'13':global[_0x5cf3b8(0xe5)]=0x0;continue;case'14':this[_0x5cf3b8(0xe8)]=_0x44c6c4[_0x5cf3b8(0xeb)];continue;case'15':global[_0x5cf3b8(0xd9)]=0x0;continue;case'16':this[_0x5cf3b8(0xbc)]=_0x54f0bf;continue;case'17':this[_0x5cf3b8(0xd0)]=_0x165e99;continue;case'18':global[_0x5cf3b8(0xc0)]=this[_0x5cf3b8(0xdf)][_0x5cf3b8(0xea)];continue;case'19':global[_0x5cf3b8(0xdb)]=0x0;continue;case'20':global['testsUnknown']=0x0;continue;case'21':global[_0x5cf3b8(0xdd)]=this['_configuration'][_0x5cf3b8(0xce)]||{};continue;case'22':global[_0x5cf3b8(0xd2)]=0x0;continue;case'23':global[_0x5cf3b8(0xc1)]={};continue;}break;}}[a31_0x4ad1e1(0xe0)](_0x5c7a4f,_0x313edf,_0x7f522a){const _0x4d0344=_0x5c7a4f['resolvePaths'];_0x5c7a4f.resolvePaths=async function(){const pathResults=await _0x4d0344.apply(this,arguments);if(!pathResults.requirePaths){pathResults.requirePaths=[];}pathResults.requirePaths=[path.join(__dirname,'../cucumber-js/test.setup.js')].concat(pathResults.requirePaths,path.join(__dirname,_0x7f522a));return pathResults;};const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;_0x313edf.push('--format'),_0x313edf.push(`"${normalizedPath}"`);}run(){return new Promise(async(resolve,reject)=>{PerformanceTester.start(PerformanceEvents.SDK_PRE_TEST);require('../../helpers/setKeepAlive')();if(this._framework==='mocha'){const mochaRunHelper=requireModule('mocha/lib/cli/run-helpers.js','mocha');const Mocha=requireModule('mocha');if(isBrowserstackInfra()){modifyCommand();}const mochaHooks=require('../mocha/test.setup').mochaHooks;if(!helper.isUndefined(this._mochaOpts.mochaRequire)){this._mochaOpts.require=this._mochaOpts.mochaRequire;const plugins=await mochaRunHelper.handleRequires([this._mochaOpts.require]);Object.assign(this._mochaOpts,plugins);}const rootHooks={beforeAll:[mochaHooks.beforeAll],beforeEach:[mochaHooks.beforeEach],afterAll:[mochaHooks.afterAll],afterEach:[mochaHooks.afterEach]};if(isTestObservabilitySession()){const mochaObservabilityHooks=require('../mocha/test-observability/data-hooks').mochaHooks;rootHooks.beforeAll.unshift(mochaObservabilityHooks.beforeAll);rootHooks.afterAll.push(mochaObservabilityHooks.afterAll);}if(this._mochaOpts.rootHooks){this._mochaOpts.rootHooks.beforeAll&&rootHooks.beforeAll.unshift(...this._mochaOpts.rootHooks.beforeAll);this._mochaOpts.rootHooks.beforeEach&&rootHooks.beforeEach.unshift(...this._mochaOpts.rootHooks.beforeEach);this._mochaOpts.rootHooks.afterAll&&rootHooks.afterAll.push(...this._mochaOpts.rootHooks.afterAll);this._mochaOpts.rootHooks.afterEach&&rootHooks.afterEach.push(...this._mochaOpts.rootHooks.afterEach);}const userReporter=this._mochaOpts.reporter;let mochaTimeout=this._mochaOpts.timeout*1;if(this._mochaOpts.timeout===0){mochaTimeout=0;}else{mochaTimeout+=constants.BSTACK_DELTA;}const mochaOpts={};Object.assign(mochaOpts,this._mochaOpts);const reporterOption={};Object.assign(reporterOption,this._mochaOpts.reporterOptions);Object.assign(reporterOption,{type:userReporter||'spec',testObservability:this._testObservability,bsConfig:this._bsConfig});mochaOpts.reporterOption=reporterOption;Object.assign(mochaOpts,{reporter:path.join(__dirname,'../mocha/bstack-reporter/customReporter.js'),parallel:false,rootHooks,isWorker:true,timeout:mochaTimeout});global.browserstackPlatformIndex=helper.nestedKeyValue(this._configuration,['platformIndex']);global.browserstackPercyBestPlatform=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','browserstackPercyBestPlatform']);global.percy=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','percy']);global.percyCaptureMode=helper.nestedKeyValue(this._configuration,['browserStackPercyOptions','percyCaptureMode']);global.capabilities=[this._capability];if(helper.isBrowserstackInfra()){if(this._bsConfig.testContextOptions.skipSessionName){global.__skipSessionName=true;}if(this._bsConfig.testContextOptions.skipSessionStatus){global.__skipSessionStatus=true;}}else{global.__skipSessionName=true;global.__skipSessionStatus=true;}if(this._bsConfig.turboScaleUrl){this._configuration.turboScaleUrl=this._bsConfig.turboScaleUrl;}const mocha=new Mocha(mochaOpts);mocha.prevRun=mocha.run;if(isTestObservabilitySession()){mocha.run=function(_){return mocha.prevRun(exit=>{const checkPendingUploadsInterval=setInterval(async()=>{PerformanceTester.start(PerformanceEvents.SDK_POST_TEST);if(RequestQueueHandler.getInstance().pendingUploads<=0){clearInterval(checkPendingUploadsInterval);await cleanupDrivers(global.__driversArray);resolve(exit);}},1000);});};}else{mocha.run=function(_){return mocha.prevRun(async exit=>{PerformanceTester.start(PerformanceEvents.SDK_POST_TEST);await cleanupDrivers(global.__driversArray);resolve(exit);});};}try{require('../../index').browserstackAgentV2(this._configuration,null,this._testObservability);}catch{}PerformanceTester.end(PerformanceEvents.SDK_PRE_TEST);const runProm=mochaRunHelper.runMocha(mocha,mochaOpts);runProm&&runProm.catch(er=>{reject(er);});}else if(this._framework==='cucumber-js'){let cucumberCli;global.capabilities=[this._capability];try{cucumberCli=requireModule('@cucumber/cucumber/lib/cli/index.js','@cucumber/cucumber');}catch(e){cucumberCli=requireModule('cucumber/lib/cli/index.js','cucumber');}const argv=this._argv;const index=argv.indexOf('cucumber-js');if(index>-1){argv.splice(index,1);}const timeoutFileName='../cucumber-js/timeout.setup.js';let paths;try{paths=requireModule('@cucumber/cucumber/lib/paths/paths.js','@cucumber/cucumber');this.setupCucumber(paths,argv,timeoutFileName);}catch(e){try{paths=requireModule('@cucumber/cucumber/lib/api/paths.js','@cucumber/cucumber');this.setupCucumber(paths,argv,timeoutFileName);}catch(e){let hookFileName='../cucumber-js/test.setup.js';let ConfigurationBuilder;try{ConfigurationBuilder=requireModule('@cucumber/cucumber/lib/cli/configuration_builder.js','@cucumber/cucumber').default;const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;argv.push('--format');argv.push(normalizedPath);}catch(e){ConfigurationBuilder=requireModule('cucumber/lib/cli/configuration_builder.js','cucumber').default;const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter_old_versions.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;argv.push('--format');argv.push(normalizedPath);hookFileName='../cucumber-js/test_old.setup.js';}const configBuilder=ConfigurationBuilder.prototype.build;ConfigurationBuilder.prototype.build=async function(){const builderHash=await configBuilder.call(this);builderHash.supportCodePaths.unshift(path.join(__dirname,hookFileName));builderHash.supportCodePaths.push(path.join(__dirname,timeoutFileName));return builderHash;};}}argv.push('--parallel');argv.push(`${this._configuration.maxWorkers}`);if(this._formatter&&this._formatter.length>0){for(let i=0;i<this._formatter.length;i++){const r=getPlatformName(this._capability).replace(/ /g,'_');if(this._formatter[i]!==undefined&&this._formatter[i].length>0){const formatterFinalOutputFileName=this._formatter[i][1];const formatterType=`${this._formatter[i][0]}`;if(formatterFinalOutputFileName!==undefined){const formatterOutputFile=`tmp/${r}${path.extname(formatterFinalOutputFileName)}`;argv.push('--format');argv.push(`${formatterType}:${formatterOutputFile}`);}else{argv.push('--format');argv.push(`${formatterType}:tmp/${r}`);}}}}const cucumber=new cucumberCli.default({argv:argv,cwd:process.cwd(),stdout:process.stdout,stderr:process.stderr,env:process.env});process.env.CONFIG=JSON.stringify(this._configuration);process.env.BSTACK_CONFIG=JSON.stringify(this._bsConfig);cucumber.run().then(async output=>{const _results={scenarios:global.testSuites,steps:global.totalTests,scenariosFailed:global.testSuitesFailed,stepsFailed:global.testsFailed,stepsPassed:global.testsPassed,stepsSkipped:global.testsSkipped,stepsPending:global.testsPending,stepsUndefined:global.testsUndefined,stepsUnknown:global.testsUnknown,stepsAmbiguous:global.testsAmbiguous,processSuccess:output.success,testsErrorMessage:global.testsErrorMessage};await RequestQueueHandler.getInstance().shutdown();resolve(_results);}).catch(async er=>{await RequestQueueHandler.getInstance().shutdown();reject(er);});}else if(this._framework==='vanilla'){global.capabilities=[this._capability];process.argv=this._configuration.args;try{modifyCommand();require('../../index').browserstackAgent(this._configuration);let i=0;process.on('beforeExit',async()=>{if(i>0){return;}i++;await cleanupDrivers(global.__driversArray);});require(this._configuration.file);}catch(er){console.error(er);await BrowserstackCLI.getInstance().stop();process.exitCode=1;reject(er);}resolve();}});}}module.exports=Launcher;
|
package/src/bin/load/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';const a32_0x3a3ef4=a32_0x673c;function a32_0x673c(_0x5d9485,_0xfd9c9b){const _0x1f1918=a32_0x1f19();return a32_0x673c=function(_0x673cc3,_0x3471dc){_0x673cc3=_0x673cc3-0x15c;let _0x372404=_0x1f1918[_0x673cc3];return _0x372404;},a32_0x673c(_0x5d9485,_0xfd9c9b);}(function(_0xe5def,_0x4a60f0){const _0x552f8b=a32_0x673c,_0x27608b=_0xe5def();while(!![]){try{const _0x5b5818=-parseInt(_0x552f8b(0x163))/0x1*(-parseInt(_0x552f8b(0x191))/0x2)+parseInt(_0x552f8b(0x197))/0x3+-parseInt(_0x552f8b(0x170))/0x4*(-parseInt(_0x552f8b(0x166))/0x5)+-parseInt(_0x552f8b(0x164))/0x6*(-parseInt(_0x552f8b(0x198))/0x7)+-parseInt(_0x552f8b(0x179))/0x8+parseInt(_0x552f8b(0x19d))/0x9*(parseInt(_0x552f8b(0x169))/0xa)+parseInt(_0x552f8b(0x18e))/0xb*(-parseInt(_0x552f8b(0x190))/0xc);if(_0x5b5818===_0x4a60f0)break;else _0x27608b['push'](_0x27608b['shift']());}catch(_0x3908e8){_0x27608b['push'](_0x27608b['shift']());}}}(a32_0x1f19,0x9183c));const {spawn}=require(a32_0x3a3ef4(0x199)),path=require('path'),helper=require(a32_0x3a3ef4(0x16d)),CLIUtils=require(a32_0x3a3ef4(0x168)),{getLoadConfigPath,sleep}=require('./loadUtils'),logger=require(a32_0x3a3ef4(0x196))[a32_0x3a3ef4(0x16f)];async function executeLoadTest(_0xd12fd7){const _0x237bd9=a32_0x3a3ef4,_0x918187={'snRak':function(_0x498c36,_0x5ef640){return _0x498c36(_0x5ef640);},'VcuHv':'close','lBroa':_0x237bd9(0x18d),'grHAb':'Loading\x20configuration\x20using\x20environment\x20variables\x20if\x20available.','VaGGy':function(_0x333cd8){return _0x333cd8();},'vItgw':_0x237bd9(0x17b),'BrDPK':_0x237bd9(0x16e),'KKAan':function(_0x5d7968){return _0x5d7968();},'BmtKS':'CLI\x20binary\x20not\x20found,\x20downloading\x20latest\x20version','ITGaM':_0x237bd9(0x16a),'lEauZ':'Failed\x20to\x20download\x20or\x20locate\x20CLI\x20binary','zVsyC':function(_0x50763c){return _0x50763c();},'kwRxA':function(_0x194abe,_0x32ce87,_0x1f4e46,_0x16fadf){return _0x194abe(_0x32ce87,_0x1f4e46,_0x16fadf);},'dvEmW':_0x237bd9(0x173),'xTWRz':_0x237bd9(0x187),'xzDik':_0x237bd9(0x19a),'eMFng':'SIGTERM','OERkH':'SIGQUIT','JpkJp':_0x237bd9(0x19e)};try{const _0x2c4216=process['argv']['slice'](0x2),_0x3b4fbf=_0x2c4216['slice'](0x1);logger[_0x237bd9(0x17d)](_0x237bd9(0x167)+_0x3b4fbf);let _0x27129b={};try{logger['debug'](_0x918187[_0x237bd9(0x171)]);const _0xece0fa={};_0xece0fa['userName']=process[_0x237bd9(0x17e)][_0x237bd9(0x194)]||process['env'][_0x237bd9(0x174)],_0xece0fa['accessKey']=process[_0x237bd9(0x17e)]['BROWSERSTACK_ACCESS_KEY']||process[_0x237bd9(0x17e)][_0x237bd9(0x184)],_0x27129b=_0xece0fa;if(!_0x27129b[_0x237bd9(0x183)]||!_0x27129b[_0x237bd9(0x18f)]){const _0x4648c9=_0x918187[_0x237bd9(0x176)](getLoadConfigPath,_0xd12fd7[_0x237bd9(0x175)]);logger['debug'](_0x237bd9(0x18c)+_0x4648c9),_0x4648c9&&(_0x27129b=helper[_0x237bd9(0x19b)](_0x4648c9));}}catch(_0x3ff144){logger['error']('Error\x20loading\x20configuration:\x20'+_0x3ff144[_0x237bd9(0x188)]),logger[_0x237bd9(0x17d)]('Error\x20details:\x20'+(_0x3ff144[_0x237bd9(0x186)]||JSON['stringify'](_0x3ff144))),await _0x918187[_0x237bd9(0x17c)](sleep),process['exit'](0x1);}(!_0x27129b['userName']||!_0x27129b[_0x237bd9(0x18f)])&&(logger[_0x237bd9(0x17a)](_0x918187['vItgw']),await _0x918187[_0x237bd9(0x17c)](sleep),process[_0x237bd9(0x189)](0x1));const _0x207d9a=CLIUtils[_0x237bd9(0x182)]();!_0x207d9a&&(logger[_0x237bd9(0x17a)](_0x918187[_0x237bd9(0x172)]),await _0x918187[_0x237bd9(0x162)](sleep),process[_0x237bd9(0x189)](0x1));let _0x16ed34=CLIUtils[_0x237bd9(0x177)](_0x207d9a);try{!_0x16ed34?(logger['debug'](_0x918187[_0x237bd9(0x192)]),_0x16ed34=await CLIUtils[_0x237bd9(0x15c)]('',_0x207d9a,_0x27129b)):(logger['debug'](_0x918187['ITGaM']),_0x16ed34=await CLIUtils[_0x237bd9(0x15c)](_0x16ed34,_0x207d9a,_0x27129b));}catch(_0x531954){logger[_0x237bd9(0x17a)](_0x918187['vItgw']),logger[_0x237bd9(0x17d)](_0x237bd9(0x180)+(_0x531954[_0x237bd9(0x186)]||JSON['stringify'](_0x531954))),await _0x918187['KKAan'](sleep),process[_0x237bd9(0x189)](0x1);}!_0x16ed34&&(logger['error'](_0x918187[_0x237bd9(0x185)]),logger[_0x237bd9(0x17d)](_0x918187[_0x237bd9(0x160)]),await _0x918187[_0x237bd9(0x17f)](sleep),process[_0x237bd9(0x189)](0x1));logger['debug']('Spawning:\x20'+_0x16ed34+'\x20load\x20'+_0x3b4fbf[_0x237bd9(0x15d)]('\x20'));const _0x5df6ad=_0x918187[_0x237bd9(0x161)](spawn,_0x16ed34,[_0x918187[_0x237bd9(0x18b)],..._0x3b4fbf],{'stdio':_0x918187[_0x237bd9(0x193)]});let _0x233c47=![];const _0x94ac3f=new Promise(_0x139a20=>{const _0x1cef37=_0x237bd9,_0xa9d9a9={'uXqgd':function(_0x5351b6,_0x552e5c){const _0x1548fa=a32_0x673c;return _0x918187[_0x1548fa(0x176)](_0x5351b6,_0x552e5c);}};_0x5df6ad['on'](_0x918187[_0x1cef37(0x181)],_0x20b823=>{const _0x3e0a15=_0x1cef37;logger[_0x3e0a15(0x17d)](_0x16ed34+'\x20exited\x20with\x20code\x20'+_0x20b823),_0xa9d9a9['uXqgd'](_0x139a20,_0x20b823);});});[_0x918187[_0x237bd9(0x15f)],_0x918187[_0x237bd9(0x195)],_0x918187['OERkH'],_0x918187[_0x237bd9(0x18a)]][_0x237bd9(0x16b)](_0x233fa5=>{process['on'](_0x233fa5,()=>{const _0x4c60f8=a32_0x673c;if(_0x233c47)return;_0x233c47=!![],logger[_0x4c60f8(0x17d)](_0x4c60f8(0x165)+_0x233fa5+_0x4c60f8(0x15e)),_0x5df6ad&&!_0x5df6ad[_0x4c60f8(0x19c)]&&(_0x5df6ad[_0x4c60f8(0x19f)](_0x233fa5),logger['debug'](_0x918187[_0x4c60f8(0x178)]));});});const _0x5a66ef=await _0x94ac3f;await _0x918187['zVsyC'](sleep),process[_0x237bd9(0x189)](_0x5a66ef);}catch(_0x2b91de){logger[_0x237bd9(0x17a)](_0x237bd9(0x16c)+_0x2b91de[_0x237bd9(0x188)]),logger[_0x237bd9(0x17d)]('Error\x20details:\x20'+(_0x2b91de[_0x237bd9(0x186)]||JSON['stringify'](_0x2b91de))),await _0x918187[_0x237bd9(0x162)](sleep),process[_0x237bd9(0x189)](0x1);}}module['exports']=executeLoadTest;function a32_0x1f19(){const _0x42c473=['VcuHv','getCliDir','userName','BROWSERSTACK_ACCESSKEY','vItgw','stack','inherit','message','exit','JpkJp','dvEmW','Configuration\x20path:\x20','Waiting\x20for\x20child\x20process\x20to\x20exit...','99616TJgHPB','accessKey','360JCTRhB','1670702evYvzG','BmtKS','xTWRz','BROWSERSTACK_USERNAME','eMFng','../../helpers/logger','144582RZOKNM','59458ZyXOPa','child_process','SIGINT','readConfig','killed','549tFkpXS','SIGHUP','kill','checkAndUpdateCli','join',',\x20forwarding\x20to\x20child\x20process...','xzDik','lEauZ','kwRxA','KKAan','1WIRxzz','90srudUA','Received\x20','320OZkjCH','Executing\x20load\x20test\x20with\x20arguments:\x20','../v2/cliUtils','25730DPjvem','CLI\x20binary\x20found,\x20Checking\x20for\x20CLI\x20updates','forEach','Failed\x20initiating\x20load\x20test:\x20','../../helpers/helper','Failed\x20to\x20determine\x20CLI\x20directory','winstonLogger','22968jqcwCr','grHAb','BrDPK','load','BROWSERSTACK_USER','argv','snRak','getExistingCliPath','lBroa','5341504LxZhOX','error','Authentication\x20incomplete.\x20Please\x20add\x20your\x20userName\x20and\x20accessKey\x20to\x20either\x20the\x20browserstack.yml\x20file\x20or\x20as\x20environment\x20variables,\x20then\x20try\x20running\x20the\x20command\x20again.','VaGGy','debug','env','zVsyC','Error\x20Details:\x20'];a32_0x1f19=function(){return _0x42c473;};return a32_0x1f19();}
|
|
2
|
+
'use strict';const a32_0x20d109=a32_0x57ff;(function(_0x4c77bf,_0x1a0b42){const _0x58c091=a32_0x57ff,_0x5bd98f=_0x4c77bf();while(!![]){try{const _0x5b5b4f=-parseInt(_0x58c091(0x224))/0x1+-parseInt(_0x58c091(0x23c))/0x2*(-parseInt(_0x58c091(0x20b))/0x3)+parseInt(_0x58c091(0x25c))/0x4*(-parseInt(_0x58c091(0x25d))/0x5)+parseInt(_0x58c091(0x202))/0x6*(parseInt(_0x58c091(0x286))/0x7)+parseInt(_0x58c091(0x266))/0x8*(-parseInt(_0x58c091(0x28e))/0x9)+-parseInt(_0x58c091(0x231))/0xa+parseInt(_0x58c091(0x21b))/0xb*(parseInt(_0x58c091(0x212))/0xc);if(_0x5b5b4f===_0x1a0b42)break;else _0x5bd98f['push'](_0x5bd98f['shift']());}catch(_0x166fde){_0x5bd98f['push'](_0x5bd98f['shift']());}}}(a32_0x5d55,0xc108d));const {spawn}=require(a32_0x20d109(0x25b)),path=require(a32_0x20d109(0x204)),helper=require(a32_0x20d109(0x20f)),CLIUtils=require(a32_0x20d109(0x217)),LoadTestModule=require(a32_0x20d109(0x216)),{getLoadConfigPath,sleep}=require(a32_0x20d109(0x285)),{classify,messageForExitCode,runtimeNotSupportedMessage,LT_EXIT_UNSUPPORTED_RUNTIME,ERROR_CODES}=require(a32_0x20d109(0x213)),{LT_SUPPORTED_NODE}=require(a32_0x20d109(0x281)),logger=require(a32_0x20d109(0x1fe))['winstonLogger'];function a32_0x5d55(){const _0x2f6022=['true','FGHGP','AUTH_INVALID','183RMepAS','YvomQ','CQRKz','Failed\x20to\x20determine\x20CLI\x20directory','../../helpers/helper','argv','CLI\x20acquisition\x20failed\x20[','276xALzmK','./loadErrors','noWdq','WDIYK','../v2/modules/loadTestModule','../v2/cliUtils','minTestedMajor','userName','env','623689scEmRB','event_name','RnCdP','No\x20browserstack-load.yml\x20/\x20browserstack.yml\x20found\x20in\x20','FzSzr','join','ENOENT','RCKvc','accessKey','1297429XSDAej','Failed\x20to\x20launch\x20the\x20Load\x20Testing\x20CLI:\x20','ycNsP','hVKsK','ssFdo','.\x20The\x20download\x20may\x20be\x20incomplete\x20or\x20corrupt\x20—\x20delete\x20it\x20(under\x20~/.browserstack/cli)\x20and\x20re-run.','catch','\x20is\x20not\x20executable\x20(permission\x20denied).\x20Check\x20file\x20permissions\x20and\x20re-run.','Loading\x20configuration\x20using\x20environment\x20variables\x20if\x20available.','LTS','exit','split','RkBds','4756700pGZesv','hbQhG','LoadCliRunFailed','debug','yXIgz','slice','SIGHUP','inherit','HvZQd','Skipping\x20downstream\x20LT\x20failure\x20report:\x20credentials\x20unavailable.','toLowerCase','29170CSnQIi','NUQrc','Executing\x20load\x20test\x20with\x20arguments:\x20','1|3|0|2|4','wIWMb','error','feature','Waiting\x20for\x20child\x20process\x20to\x20exit...','oKxYq','CLI\x20binary\x20not\x20found,\x20downloading\x20latest\x20version','kill','Unexpected\x20load\x20error\x20[','Node.js\x20v','dkFbq','XHJFv','ryApL','empty-binary-path','vdWhT','QclXi','TGSTX','cDkdX','SIGQUIT','olVXF','errorCode','NKbqu',').\x20It\x20may\x20work;\x20if\x20you\x20hit\x20issues,\x20switch\x20to\x20a\x20validated\x20Node.js\x20version.','OxEGn','resolve','Failed\x20initiating\x20load\x20test:\x20','then','Configuration\x20path:\x20','child_process','230276cqehlc','85Oahgsc','Received\x20','xWrQB','PNPKA','Spawning:\x20','Authentication\x20incomplete.\x20Please\x20add\x20your\x20userName\x20and\x20accessKey\x20to\x20either\x20the\x20browserstack.yml\x20file\x20or\x20as\x20environment\x20variables,\x20then\x20try\x20running\x20the\x20command\x20again.','stringify','assign','Could\x20not\x20report\x20Load\x20Testing\x20failure\x20downstream:\x20','40008IkadEK','EACCES','\x20is\x20older\x20than\x20the\x20oldest\x20version\x20validated\x20for\x20BrowserStack\x20Load\x20Testing\x20(Node\x20','SmSuG','UNKNOWN','getExistingCliPath','detectedNodeMajor','UYLLU','Failed\x20to\x20load\x20Load\x20Testing\x20configuration:\x20','ztmIh','readConfig',');\x20not\x20reported\x20as\x20a\x20failure.','hardMinMajor','The\x20BrowserStack\x20Load\x20Testing\x20CLI\x20binary\x20at\x20','warn','\x20exited\x20with\x20code\x20','khTFl','DXMtJ','BROWSERSTACK_USERNAME',']:\x20','SXgOk','BROWSERSTACK_USER','stack','TQAJZ','message','forEach','TwGQj','../utils/constants','code','nOCbh','GDWzJ','./loadUtils','10946054VxokHA','biPWq','no-writable-cli-dir','UNSUPPORTED_RUNTIME','oNLXw','CONFIG_PARSE','BROWSERSTACK_ACCESS_KEY','sZWnD','387ttcfOV','Unable\x20to\x20launch\x20the\x20BrowserStack\x20Load\x20Testing\x20CLI\x20binary\x20at\x20','Ocdhu','rnyuM','ckZhu','JICWf','UQfeS','nUZYa','KHBCX','yrUpK','yes','rGmLj','node','close','checkAndUpdateCli','BROWSERSTACK_SKIP_NODE_CHECK','../../helpers/logger','zIBYA','includes','LTS\x20session\x20linking\x20skipped:\x20','6FErjpM','DlJWe','path','getCliDir','missing-credentials','Spawn\x20error\x20details:\x20'];a32_0x5d55=function(){return _0x2f6022;};return a32_0x5d55();}async function reportFailureToLTS(_0x3ad750,_0x2fc2c7,_0x25e54e={}){const _0x3a5cf0=a32_0x20d109,_0xef6dd9={'yXIgz':function(_0x77a4ad,_0x49db59,_0x65e833){return _0x77a4ad(_0x49db59,_0x65e833);},'ckZhu':_0x3a5cf0(0x23a),'wIWMb':_0x3a5cf0(0x22d),'ypodl':_0x3a5cf0(0x233),'GDWzJ':function(_0x59fdc2,_0x4dc6f1){return _0x59fdc2(_0x4dc6f1);}};if(!_0x3ad750||!_0x3ad750['userName']||!_0x3ad750[_0x3a5cf0(0x223)]){logger[_0x3a5cf0(0x234)](_0xef6dd9[_0x3a5cf0(0x1f2)]);return;}const _0x34f7d0={};_0x34f7d0[_0x3a5cf0(0x242)]=_0xef6dd9[_0x3a5cf0(0x240)],_0x34f7d0[_0x3a5cf0(0x21c)]=_0xef6dd9['ypodl'],_0x34f7d0[_0x3a5cf0(0x253)]=_0x2fc2c7||ERROR_CODES[_0x3a5cf0(0x26a)];const _0x13c0c2=Object[_0x3a5cf0(0x264)](_0x34f7d0,_0x25e54e),_0x4f164f=Promise[_0x3a5cf0(0x257)]()[_0x3a5cf0(0x259)](()=>helper['sendToEDS'](_0x13c0c2,_0x3ad750||{}))[_0x3a5cf0(0x22a)](_0x421d73=>{const _0x30d360=_0x3a5cf0;logger[_0x30d360(0x274)](_0x30d360(0x265)+(_0x421d73&&_0x421d73[_0x30d360(0x27e)]));});let _0x191062;const _0x4e9594=new Promise(_0x24629c=>{const _0x61aeba=_0x3a5cf0;_0x191062=_0xef6dd9[_0x61aeba(0x235)](setTimeout,_0x24629c,0xbb8);});await Promise['race']([_0x4f164f,_0x4e9594]),_0xef6dd9[_0x3a5cf0(0x284)](clearTimeout,_0x191062);}async function assertSupportedRuntime(_0xb98845){const _0x4a7490=a32_0x20d109,_0x214bfc={'KHBCX':function(_0x405f00,_0x46c620){return _0x405f00(_0x46c620);},'PNPKA':_0x4a7490(0x208),'KGyOV':_0x4a7490(0x1f8),'yrUpK':function(_0x347024,_0x5645cd){return _0x347024||_0x5645cd;},'FzSzr':function(_0x22d82c,_0x39ed7f,_0x2cc2c0){return _0x22d82c(_0x39ed7f,_0x2cc2c0);},'RgOml':function(_0x1788e8,_0x1b3229){return _0x1788e8<_0x1b3229;},'QLECv':function(_0x5e627e,_0x2a609f,_0x3da735,_0x8fa6fa){return _0x5e627e(_0x2a609f,_0x3da735,_0x8fa6fa);},'TGSTX':function(_0x1693ac){return _0x1693ac();},'NoiFe':function(_0x531698,_0x2cc158){return _0x531698>_0x2cc158;}},_0x39c7af=_0x214bfc[_0x4a7490(0x1f6)](String,process['env'][_0x4a7490(0x1fd)]||'')[_0x4a7490(0x23b)]();if([_0x214bfc[_0x4a7490(0x260)],'1',_0x214bfc['KGyOV']][_0x4a7490(0x200)](_0x39c7af))return;const _0xf8c2bd=_0x214bfc[_0x4a7490(0x1f7)](LT_SUPPORTED_NODE,{}),_0x11dd5e=_0x214bfc[_0x4a7490(0x21f)](parseInt,_0x214bfc[_0x4a7490(0x1f6)](String,process['versions'][_0x4a7490(0x1fa)])[_0x4a7490(0x22f)]('.')[0x0],0xa);if(!Number['isFinite'](_0x11dd5e))return;if(_0xf8c2bd[_0x4a7490(0x272)]&&_0x214bfc['RgOml'](_0x11dd5e,_0xf8c2bd[_0x4a7490(0x272)])){logger[_0x4a7490(0x241)](_0x214bfc[_0x4a7490(0x21f)](runtimeNotSupportedMessage,_0x11dd5e,_0xf8c2bd));const _0x32e9c4={};_0x32e9c4[_0x4a7490(0x26c)]=_0x11dd5e,await _0x214bfc['QLECv'](reportFailureToLTS,_0xb98845,ERROR_CODES[_0x4a7490(0x289)],_0x32e9c4),await _0x214bfc[_0x4a7490(0x24f)](sleep),process[_0x4a7490(0x22e)](LT_EXIT_UNSUPPORTED_RUNTIME);}if(_0xf8c2bd[_0x4a7490(0x218)]&&_0x214bfc['RgOml'](_0x11dd5e,_0xf8c2bd['minTestedMajor']))logger['warn'](_0x4a7490(0x248)+_0x11dd5e+_0x4a7490(0x268)+_0xf8c2bd[_0x4a7490(0x218)]+').\x20It\x20may\x20work;\x20if\x20you\x20hit\x20issues,\x20switch\x20to\x20a\x20validated\x20Node.js\x20version.');else _0xf8c2bd['maxTestedMajor']&&_0x214bfc['NoiFe'](_0x11dd5e,_0xf8c2bd['maxTestedMajor'])&&logger[_0x4a7490(0x274)](_0x4a7490(0x248)+_0x11dd5e+'\x20is\x20newer\x20than\x20the\x20latest\x20version\x20validated\x20for\x20BrowserStack\x20Load\x20Testing\x20(up\x20to\x20Node\x20'+_0xf8c2bd['maxTestedMajor']+_0x4a7490(0x255));}async function executeLoadTest(_0x1a58c0){const _0x30fa89=a32_0x20d109,_0x2d8985={'nUZYa':function(_0x4444ee,_0x360305){return _0x4444ee!==_0x360305;},'JICWf':function(_0x5d8f40,_0xd0d981){return _0x5d8f40!==_0xd0d981;},'SmSuG':function(_0x1ee18c,_0x175bec){return _0x1ee18c(_0x175bec);},'vdWhT':function(_0xe3f539,_0x33974d){return _0xe3f539===_0x33974d;},'DlJWe':_0x30fa89(0x221),'bSYkL':function(_0x2e9c15,_0xf1f5be){return _0x2e9c15===_0xf1f5be;},'NKbqu':_0x30fa89(0x267),'noWdq':function(_0x1a5f31,_0x1658c4){return _0x1a5f31(_0x1658c4);},'zIBYA':_0x30fa89(0x241),'TQAJZ':_0x30fa89(0x1fb),'OxEGn':_0x30fa89(0x243),'HvZQd':_0x30fa89(0x22c),'SXgOk':function(_0x446dda,_0x5df9ec,_0x44f6d0){return _0x446dda(_0x5df9ec,_0x44f6d0);},'ycNsP':function(_0x6fb2bc){return _0x6fb2bc();},'UYLLU':function(_0x9a4a10,_0x3e9c1b){return _0x9a4a10(_0x3e9c1b);},'RkBds':function(_0x50211d,_0x36a0b1,_0x3ea9e4){return _0x50211d(_0x36a0b1,_0x3ea9e4);},'oNLXw':_0x30fa89(0x262),'dkFbq':function(_0x579c5c,_0x523826,_0x3343b1,_0xe501e8){return _0x579c5c(_0x523826,_0x3343b1,_0xe501e8);},'xWrQB':_0x30fa89(0x206),'bDNAL':function(_0x3a2578,_0x5b0067){return _0x3a2578(_0x5b0067);},'DXMtJ':_0x30fa89(0x20e),'sZWnD':_0x30fa89(0x288),'QclXi':function(_0x5f36ea){return _0x5f36ea();},'olVXF':_0x30fa89(0x245),'RnCdP':'CLI\x20binary\x20found,\x20Checking\x20for\x20CLI\x20updates','XHJFv':function(_0x4660e8,_0x4ba576){return _0x4660e8(_0x4ba576);},'TwGQj':function(_0x3b2ef4,_0x343c7b,_0x349bfe){return _0x3b2ef4(_0x343c7b,_0x349bfe);},'FGHGP':_0x30fa89(0x23f),'dCyoq':_0x30fa89(0x24c),'YvomQ':'Could\x20not\x20obtain\x20the\x20BrowserStack\x20Load\x20Testing\x20CLI\x20binary:\x20the\x20download\x20or\x20extraction\x20did\x20not\x20produce\x20a\x20usable\x20binary.\x20Re-run\x20with\x20DEBUG=true\x20for\x20details,\x20or\x20contact\x20BrowserStack\x20support\x20if\x20this\x20persists.','WDIYK':function(_0x418d84){return _0x418d84();},'NUQrc':'checkAndUpdateCli\x20returned\x20an\x20empty\x20binary\x20path','RCKvc':function(_0x2cb146,_0x473d41,_0x1efad0,_0x37470b){return _0x2cb146(_0x473d41,_0x1efad0,_0x37470b);},'oKxYq':'load','nOCbh':_0x30fa89(0x238),'ssFdo':'SIGINT','rnyuM':'SIGTERM','CQRKz':_0x30fa89(0x251),'hVKsK':_0x30fa89(0x237),'rGmLj':function(_0x3ec863,_0x1e8337){return _0x3ec863!==_0x1e8337;},'hbQhG':function(_0x4359ca){return _0x4359ca();},'Ocdhu':function(_0x31bdb9,_0x24528e){return _0x31bdb9(_0x24528e);},'ryApL':function(_0x59cd95){return _0x59cd95();}};let _0x44618e={};try{const _0x30a739=process[_0x30fa89(0x210)][_0x30fa89(0x236)](0x2),_0x5e7dc4=_0x30a739[_0x30fa89(0x236)](0x1);logger[_0x30fa89(0x234)](_0x30fa89(0x23e)+_0x5e7dc4);try{logger[_0x30fa89(0x234)](_0x2d8985[_0x30fa89(0x239)]);const _0x34f8b6={};_0x34f8b6[_0x30fa89(0x219)]=process[_0x30fa89(0x21a)][_0x30fa89(0x278)]||process['env'][_0x30fa89(0x27b)],_0x34f8b6[_0x30fa89(0x223)]=process[_0x30fa89(0x21a)][_0x30fa89(0x28c)]||process['env']['BROWSERSTACK_ACCESSKEY'],_0x44618e=_0x34f8b6;if(!_0x44618e[_0x30fa89(0x219)]||!_0x44618e[_0x30fa89(0x223)]){const _0xd75deb=_0x2d8985[_0x30fa89(0x269)](getLoadConfigPath,_0x1a58c0[_0x30fa89(0x210)]);logger[_0x30fa89(0x234)](_0x30fa89(0x25a)+_0xd75deb),_0xd75deb?(_0x44618e=helper[_0x30fa89(0x270)](_0xd75deb),_0x44618e&&_0x44618e[_0x30fa89(0x241)]&&(logger['error']('Failed\x20to\x20read\x20Load\x20Testing\x20configuration\x20at\x20'+_0xd75deb+':\x20'+_0x44618e[_0x30fa89(0x241)]),await _0x2d8985[_0x30fa89(0x27a)](reportFailureToLTS,_0x44618e,ERROR_CODES[_0x30fa89(0x28b)]),await _0x2d8985[_0x30fa89(0x226)](sleep),process[_0x30fa89(0x22e)](0x1))):logger['info'](_0x30fa89(0x21e)+process['cwd']()+';\x20relying\x20on\x20environment\x20variables\x20for\x20credentials.');}}catch(_0x14058c){const {userMessage:_0x75d39b,code:_0x3a95d5}=_0x2d8985[_0x30fa89(0x26d)](classify,_0x14058c);logger[_0x30fa89(0x241)](_0x30fa89(0x26e)+_0x75d39b),logger[_0x30fa89(0x234)]('Config\x20load\x20error\x20['+_0x3a95d5+_0x30fa89(0x279)+(_0x14058c&&(_0x14058c[_0x30fa89(0x27c)]||JSON[_0x30fa89(0x263)](_0x14058c)))),await _0x2d8985[_0x30fa89(0x230)](reportFailureToLTS,_0x44618e,_0x3a95d5),await _0x2d8985['ycNsP'](sleep),process[_0x30fa89(0x22e)](0x1);}(!_0x44618e[_0x30fa89(0x219)]||!_0x44618e[_0x30fa89(0x223)])&&(logger[_0x30fa89(0x241)](_0x2d8985[_0x30fa89(0x28a)]),await _0x2d8985[_0x30fa89(0x249)](reportFailureToLTS,_0x44618e,ERROR_CODES[_0x30fa89(0x20a)],{'reason':_0x2d8985[_0x30fa89(0x25f)]}),await _0x2d8985['ycNsP'](sleep),process['exit'](0x1));await _0x2d8985['bDNAL'](assertSupportedRuntime,_0x44618e);try{await LoadTestModule['setLTSSessionId'](_0x44618e);}catch(_0x11b011){logger['debug'](_0x30fa89(0x201)+(_0x11b011&&_0x11b011[_0x30fa89(0x27e)]));}const _0x121034=CLIUtils[_0x30fa89(0x205)]();!_0x121034&&(logger[_0x30fa89(0x241)](_0x2d8985[_0x30fa89(0x277)]),await _0x2d8985[_0x30fa89(0x249)](reportFailureToLTS,_0x44618e,ERROR_CODES['FS_PERMISSION'],{'reason':_0x2d8985[_0x30fa89(0x28d)]}),await _0x2d8985[_0x30fa89(0x24e)](sleep),process[_0x30fa89(0x22e)](0x1));let _0xb37f84=CLIUtils[_0x30fa89(0x26b)](_0x121034);try{!_0xb37f84?(logger[_0x30fa89(0x234)](_0x2d8985[_0x30fa89(0x252)]),_0xb37f84=await CLIUtils['checkAndUpdateCli']('',_0x121034,_0x44618e)):(logger[_0x30fa89(0x234)](_0x2d8985[_0x30fa89(0x21d)]),_0xb37f84=await CLIUtils[_0x30fa89(0x1fc)](_0xb37f84,_0x121034,_0x44618e));}catch(_0x143380){const {code:_0x57fc18,userMessage:_0x1c6b85}=_0x2d8985[_0x30fa89(0x24a)](classify,_0x143380);logger[_0x30fa89(0x241)](_0x1c6b85),logger[_0x30fa89(0x234)](_0x30fa89(0x211)+_0x57fc18+_0x30fa89(0x279)+(_0x143380&&(_0x143380['stack']||_0x143380[_0x30fa89(0x27e)]||JSON['stringify'](_0x143380)))),await _0x2d8985[_0x30fa89(0x280)](reportFailureToLTS,_0x44618e,_0x57fc18),await _0x2d8985[_0x30fa89(0x24e)](sleep),process[_0x30fa89(0x22e)](0x1);}if(!_0xb37f84){const _0x220153=_0x2d8985[_0x30fa89(0x209)][_0x30fa89(0x22f)]('|');let _0x5903f3=0x0;while(!![]){switch(_0x220153[_0x5903f3++]){case'0':await _0x2d8985['dkFbq'](reportFailureToLTS,_0x44618e,ERROR_CODES[_0x30fa89(0x26a)],{'reason':_0x2d8985['dCyoq']});continue;case'1':logger['error'](_0x2d8985[_0x30fa89(0x20c)]);continue;case'2':await _0x2d8985[_0x30fa89(0x215)](sleep);continue;case'3':logger[_0x30fa89(0x234)](_0x2d8985[_0x30fa89(0x23d)]);continue;case'4':process['exit'](0x1);continue;}break;}}logger[_0x30fa89(0x234)](_0x30fa89(0x261)+_0xb37f84+'\x20load\x20'+_0x5e7dc4[_0x30fa89(0x220)]('\x20'));const _0x5a1e5e=_0x2d8985[_0x30fa89(0x222)](spawn,_0xb37f84,[_0x2d8985[_0x30fa89(0x244)],..._0x5e7dc4],{'stdio':_0x2d8985[_0x30fa89(0x283)]});let _0x4dadf9=![];const _0x589984=new Promise(_0x2ad8f1=>{const _0x318d67=_0x30fa89,_0x3f2c13={'khTFl':function(_0x2990ef,_0x222bea){const _0x72fc2=a32_0x57ff;return _0x2d8985[_0x72fc2(0x269)](_0x2990ef,_0x222bea);},'cDkdX':function(_0x37bccb,_0x59a9a1){const _0x362f28=a32_0x57ff;return _0x2d8985[_0x362f28(0x24d)](_0x37bccb,_0x59a9a1);},'biPWq':_0x2d8985[_0x318d67(0x203)],'UQfeS':function(_0x2a694f,_0x232385){return _0x2d8985['bSYkL'](_0x2a694f,_0x232385);},'cYwIf':_0x2d8985[_0x318d67(0x254)],'cZvKv':function(_0x176ba6,_0x47d664){const _0x4b7f86=_0x318d67;return _0x2d8985[_0x4b7f86(0x214)](_0x176ba6,_0x47d664);}};let _0x3ae820=![],_0x843a25=![];const _0x518431=_0x256f28=>{const _0x1f3f2e=_0x318d67;if(_0x3ae820)return;_0x3ae820=!![],_0x3f2c13[_0x1f3f2e(0x276)](_0x2ad8f1,_0x256f28);};_0x5a1e5e['on'](_0x2d8985[_0x318d67(0x1ff)],_0x480cf9=>{const _0x57af61=_0x318d67;_0x843a25=!![];let _0x34a9f7=0x1;if(_0x480cf9&&_0x3f2c13[_0x57af61(0x250)](_0x480cf9[_0x57af61(0x282)],_0x3f2c13[_0x57af61(0x287)]))_0x34a9f7=0x7f,logger[_0x57af61(0x241)](_0x57af61(0x28f)+_0xb37f84+_0x57af61(0x229));else{if(_0x480cf9&&_0x3f2c13[_0x57af61(0x1f4)](_0x480cf9[_0x57af61(0x282)],_0x3f2c13['cYwIf']))_0x34a9f7=0x7e,logger[_0x57af61(0x241)](_0x57af61(0x273)+_0xb37f84+_0x57af61(0x22b));else{const {userMessage:_0x439762}=_0x3f2c13['khTFl'](classify,_0x480cf9);logger[_0x57af61(0x241)](_0x57af61(0x225)+_0x439762);}}logger[_0x57af61(0x234)](_0x57af61(0x207)+(_0x480cf9&&(_0x480cf9[_0x57af61(0x27c)]||_0x480cf9[_0x57af61(0x27e)]))),_0x3f2c13['cZvKv'](_0x518431,_0x34a9f7);}),_0x5a1e5e['on'](_0x2d8985[_0x318d67(0x27d)],_0x10f43a=>{const _0x28b989=_0x318d67;!_0x843a25&&(_0x2d8985[_0x28b989(0x1f5)](_0x10f43a,0x0)&&_0x2d8985[_0x28b989(0x1f3)](_0x10f43a,null)?logger[_0x28b989(0x241)](_0x2d8985[_0x28b989(0x269)](messageForExitCode,_0x10f43a)):logger[_0x28b989(0x234)](_0xb37f84+_0x28b989(0x275)+_0x10f43a)),_0x2d8985['SmSuG'](_0x518431,_0x2d8985['vdWhT'](_0x10f43a,null)?0x1:_0x10f43a);});});[_0x2d8985[_0x30fa89(0x228)],_0x2d8985[_0x30fa89(0x1f1)],_0x2d8985[_0x30fa89(0x20d)],_0x2d8985[_0x30fa89(0x227)]][_0x30fa89(0x27f)](_0x3c5e6e=>{const _0x3394d2=_0x30fa89,_0x49d455={};_0x49d455[_0x3394d2(0x26f)]=_0x2d8985[_0x3394d2(0x256)];const _0x4f7194=_0x49d455;process['on'](_0x3c5e6e,()=>{const _0x4f7cb0=_0x3394d2;if(_0x4dadf9)return;_0x4dadf9=!![],logger[_0x4f7cb0(0x234)](_0x4f7cb0(0x25e)+_0x3c5e6e+',\x20forwarding\x20to\x20child\x20process...'),_0x5a1e5e&&!_0x5a1e5e['killed']&&(_0x5a1e5e[_0x4f7cb0(0x246)](_0x3c5e6e),logger['debug'](_0x4f7194[_0x4f7cb0(0x26f)]));});});const _0x195eb3=await _0x589984;if(_0x2d8985[_0x30fa89(0x1f5)](_0x195eb3,0x0)&&!_0x4dadf9){const _0x4e45e1={};_0x4e45e1['exitCode']=_0x195eb3,await _0x2d8985[_0x30fa89(0x249)](reportFailureToLTS,_0x44618e,ERROR_CODES[_0x30fa89(0x26a)],_0x4e45e1);}else _0x2d8985[_0x30fa89(0x1f9)](_0x195eb3,0x0)&&_0x4dadf9&&logger[_0x30fa89(0x234)]('Load\x20test\x20cancelled\x20by\x20signal\x20(exit\x20code\x20'+_0x195eb3+_0x30fa89(0x271));await _0x2d8985[_0x30fa89(0x232)](sleep),process['exit'](_0x195eb3);}catch(_0x21730e){const {code:_0x590bb4,userMessage:_0x327620}=_0x2d8985[_0x30fa89(0x1f0)](classify,_0x21730e);logger[_0x30fa89(0x241)](_0x30fa89(0x258)+_0x327620),logger[_0x30fa89(0x234)](_0x30fa89(0x247)+_0x590bb4+_0x30fa89(0x279)+(_0x21730e&&(_0x21730e['stack']||JSON['stringify'](_0x21730e)))),await _0x2d8985[_0x30fa89(0x280)](reportFailureToLTS,_0x44618e,_0x590bb4),await _0x2d8985[_0x30fa89(0x24b)](sleep),process[_0x30fa89(0x22e)](0x1);}}function a32_0x57ff(_0x43c7ef,_0x2fbaea){const _0x5d555e=a32_0x5d55();return a32_0x57ff=function(_0x57fff0,_0x5240d6){_0x57fff0=_0x57fff0-0x1f0;let _0x2209c3=_0x5d555e[_0x57fff0];return _0x2209c3;},a32_0x57ff(_0x43c7ef,_0x2fbaea);}module['exports']=executeLoadTest;
|
|
@@ -5,17 +5,104 @@ const {spawn} = require('child_process');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const helper = require('../../helpers/helper');
|
|
7
7
|
const CLIUtils = require('../v2/cliUtils');
|
|
8
|
+
const LoadTestModule = require('../v2/modules/loadTestModule');
|
|
8
9
|
const {getLoadConfigPath, sleep} = require('./loadUtils');
|
|
10
|
+
const {
|
|
11
|
+
classify,
|
|
12
|
+
messageForExitCode,
|
|
13
|
+
runtimeNotSupportedMessage,
|
|
14
|
+
LT_EXIT_UNSUPPORTED_RUNTIME,
|
|
15
|
+
ERROR_CODES
|
|
16
|
+
} = require('./loadErrors');
|
|
17
|
+
const {LT_SUPPORTED_NODE} = require('../utils/constants');
|
|
9
18
|
const logger = require('../../helpers/logger').winstonLogger;
|
|
10
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Best-effort downstream failure propagation to the Load Testing solution
|
|
22
|
+
* (SDK-6442): emit an EDS event so a failed load run is visible to the LT
|
|
23
|
+
* backend/support even when the Go binary never started or exited non-zero.
|
|
24
|
+
* Capped via a race so it never blocks the user's exit on a slow/unreachable
|
|
25
|
+
* network. Only meaningful once credentials are resolved (EDS needs auth).
|
|
26
|
+
*/
|
|
27
|
+
async function reportFailureToLTS(config, errorCode, extra = {}) {
|
|
28
|
+
// EDS needs credentials to authenticate the event. On a pre-credential failure
|
|
29
|
+
// (config parse / missing creds) skip silently rather than fire an
|
|
30
|
+
// unauthenticated call that can only fail and add a noisy warn. This lets every
|
|
31
|
+
// terminal path call reportFailureToLTS uniformly; it delivers wherever creds
|
|
32
|
+
// are resolved and no-ops (quietly) where they are not.
|
|
33
|
+
if (!config || !config.userName || !config.accessKey) {
|
|
34
|
+
logger.debug('Skipping downstream LT failure report: credentials unavailable.');
|
|
35
|
+
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const props = Object.assign({
|
|
39
|
+
feature: 'LTS',
|
|
40
|
+
// event_name becomes the TOP-LEVEL EDS event_name (sendToEDS forwards it),
|
|
41
|
+
// so downstream queries/alerts can actually filter on LoadCliRunFailed rather
|
|
42
|
+
// than the default SDKFeaturePerformance (SDK-6442).
|
|
43
|
+
event_name: 'LoadCliRunFailed',
|
|
44
|
+
errorCode: errorCode || ERROR_CODES.UNKNOWN
|
|
45
|
+
}, extra);
|
|
46
|
+
// Own the rejection on the send promise itself so that if the 3s cap wins the
|
|
47
|
+
// race, a later EDS rejection (the exact failure this telemetry targets) cannot
|
|
48
|
+
// surface as an unhandled rejection during the subsequent sleep/exit.
|
|
49
|
+
const send = Promise.resolve()
|
|
50
|
+
.then(() => helper.sendToEDS(props, config || {}))
|
|
51
|
+
.catch((e) => {
|
|
52
|
+
logger.warn(`Could not report Load Testing failure downstream: ${e && e.message}`);
|
|
53
|
+
});
|
|
54
|
+
let timer;
|
|
55
|
+
const cap = new Promise((resolve) => {
|
|
56
|
+
timer = setTimeout(resolve, 3000);
|
|
57
|
+
});
|
|
58
|
+
await Promise.race([send, cap]);
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Reject unsupported Node runtimes up front (the SDK-6442 / SDK-6188 scenario)
|
|
64
|
+
* with a clear, machine-detectable message, before any download or spawn.
|
|
65
|
+
* Hard-fails below the supported floor; warns (does not block) above the newest
|
|
66
|
+
* validated major so working-but-untested versions are not falsely rejected.
|
|
67
|
+
* Bypass with BROWSERSTACK_SKIP_NODE_CHECK=true.
|
|
68
|
+
*/
|
|
69
|
+
async function assertSupportedRuntime(config) {
|
|
70
|
+
const skip = String(process.env.BROWSERSTACK_SKIP_NODE_CHECK || '').toLowerCase();
|
|
71
|
+
if (['true', '1', 'yes'].includes(skip)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const range = LT_SUPPORTED_NODE || {};
|
|
75
|
+
const detectedMajor = parseInt(String(process.versions.node).split('.')[0], 10);
|
|
76
|
+
if (!Number.isFinite(detectedMajor)) {
|
|
77
|
+
return; // can't determine the runtime — don't block
|
|
78
|
+
}
|
|
79
|
+
// Hard-fail ONLY below a confirmed floor. hardMinMajor is intentionally null
|
|
80
|
+
// until the authoritative range is confirmed (SDK-6442), so this branch is
|
|
81
|
+
// dormant and the preflight is warn-only — an unconfirmed bound must not
|
|
82
|
+
// exit(78) a currently-working user.
|
|
83
|
+
if (range.hardMinMajor && detectedMajor < range.hardMinMajor) {
|
|
84
|
+
logger.error(runtimeNotSupportedMessage(detectedMajor, range));
|
|
85
|
+
await reportFailureToLTS(config, ERROR_CODES.UNSUPPORTED_RUNTIME, {detectedNodeMajor: detectedMajor});
|
|
86
|
+
await sleep();
|
|
87
|
+
process.exit(LT_EXIT_UNSUPPORTED_RUNTIME);
|
|
88
|
+
}
|
|
89
|
+
// Outside the validated band → heads-up only, never block.
|
|
90
|
+
if (range.minTestedMajor && detectedMajor < range.minTestedMajor) {
|
|
91
|
+
logger.warn(`Node.js v${detectedMajor} is older than the oldest version validated for BrowserStack Load Testing (Node ${range.minTestedMajor}). It may work; if you hit issues, switch to a validated Node.js version.`);
|
|
92
|
+
} else if (range.maxTestedMajor && detectedMajor > range.maxTestedMajor) {
|
|
93
|
+
logger.warn(`Node.js v${detectedMajor} is newer than the latest version validated for BrowserStack Load Testing (up to Node ${range.maxTestedMajor}). It may work; if you hit issues, switch to a validated Node.js version.`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
11
97
|
|
|
12
98
|
async function executeLoadTest(yargs) {
|
|
99
|
+
// Hoisted so the outer catch can report it downstream.
|
|
100
|
+
let config = {};
|
|
13
101
|
try {
|
|
14
102
|
const rawArgs = process.argv.slice(2);
|
|
15
103
|
const loadArgs = rawArgs.slice(1);
|
|
16
104
|
|
|
17
105
|
logger.debug(`Executing load test with arguments: ${loadArgs}`);
|
|
18
|
-
let config = {};
|
|
19
106
|
|
|
20
107
|
try {
|
|
21
108
|
logger.debug('Loading configuration using environment variables if available.');
|
|
@@ -30,25 +117,55 @@ async function executeLoadTest(yargs) {
|
|
|
30
117
|
|
|
31
118
|
if (configPath) {
|
|
32
119
|
config = helper.readConfig(configPath);
|
|
120
|
+
// readConfig returns an {error} sentinel (not a throw) on a YAML
|
|
121
|
+
// parse / read failure. Surface it as a config error rather than
|
|
122
|
+
// letting it fall through to the misleading "Authentication
|
|
123
|
+
// incomplete" message below.
|
|
124
|
+
if (config && config.error) {
|
|
125
|
+
logger.error(`Failed to read Load Testing configuration at ${configPath}: ${config.error}`);
|
|
126
|
+
await reportFailureToLTS(config, ERROR_CODES.CONFIG_PARSE);
|
|
127
|
+
await sleep();
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
logger.info(`No browserstack-load.yml / browserstack.yml found in ${process.cwd()}; relying on environment variables for credentials.`);
|
|
33
132
|
}
|
|
34
133
|
}
|
|
35
134
|
} catch (error) {
|
|
36
|
-
|
|
37
|
-
logger.
|
|
135
|
+
const {userMessage, code} = classify(error);
|
|
136
|
+
logger.error(`Failed to load Load Testing configuration: ${userMessage}`);
|
|
137
|
+
logger.debug(`Config load error [${code}]: ${error && (error.stack || JSON.stringify(error))}`);
|
|
138
|
+
await reportFailureToLTS(config, code);
|
|
38
139
|
await sleep(); // Added sleep to ensure logs are flushed
|
|
39
140
|
process.exit(1);
|
|
40
141
|
}
|
|
41
142
|
|
|
42
143
|
if (!config.userName || !config.accessKey) {
|
|
43
144
|
logger.error('Authentication incomplete. Please add your userName and accessKey to either the browserstack.yml file or as environment variables, then try running the command again.');
|
|
145
|
+
await reportFailureToLTS(config, ERROR_CODES.AUTH_INVALID, {reason: 'missing-credentials'});
|
|
44
146
|
await sleep();
|
|
45
147
|
process.exit(1);
|
|
46
148
|
}
|
|
47
149
|
|
|
150
|
+
// Reject unsupported Node runtimes up front, before any download/spawn
|
|
151
|
+
// (the SDK-6442 / SDK-6188 scenario). Credentials are resolved by now, so a
|
|
152
|
+
// rejection can also be reported downstream to the LT backend.
|
|
153
|
+
await assertSupportedRuntime(config);
|
|
154
|
+
|
|
155
|
+
// Standalone `load` runs are Load Testing sessions: link the LTS session id
|
|
156
|
+
// (if provided) and emit LTS presence telemetry. Previously only the
|
|
157
|
+
// automation path (browserstackCLI.js) did this.
|
|
158
|
+
try {
|
|
159
|
+
await LoadTestModule.setLTSSessionId(config);
|
|
160
|
+
} catch (ltsErr) {
|
|
161
|
+
logger.debug(`LTS session linking skipped: ${ltsErr && ltsErr.message}`);
|
|
162
|
+
}
|
|
163
|
+
|
|
48
164
|
// Get the CLI directory
|
|
49
165
|
const cliDir = CLIUtils.getCliDir();
|
|
50
166
|
if (!cliDir) {
|
|
51
167
|
logger.error('Failed to determine CLI directory');
|
|
168
|
+
await reportFailureToLTS(config, ERROR_CODES.FS_PERMISSION, {reason: 'no-writable-cli-dir'});
|
|
52
169
|
await sleep();
|
|
53
170
|
process.exit(1);
|
|
54
171
|
}
|
|
@@ -67,15 +184,24 @@ async function executeLoadTest(yargs) {
|
|
|
67
184
|
binaryPath = await CLIUtils.checkAndUpdateCli(binaryPath, cliDir, config);
|
|
68
185
|
}
|
|
69
186
|
} catch (error) {
|
|
70
|
-
|
|
71
|
-
|
|
187
|
+
// Credentials are already confirmed present above (line ~42), so a
|
|
188
|
+
// failure here is NOT a missing-credentials problem. Classify the real
|
|
189
|
+
// cause (network, proxy/SSL, HTTP error, corrupt download, filesystem,
|
|
190
|
+
// disk-full, …) and surface an actionable message instead of the old
|
|
191
|
+
// blanket "Authentication incomplete" that sent valid-credential users
|
|
192
|
+
// to edit browserstack.yml in vain (SDK-6442 / SDK-6188).
|
|
193
|
+
const {code, userMessage} = classify(error);
|
|
194
|
+
logger.error(userMessage);
|
|
195
|
+
logger.debug(`CLI acquisition failed [${code}]: ${error && (error.stack || error.message || JSON.stringify(error))}`);
|
|
196
|
+
await reportFailureToLTS(config, code);
|
|
72
197
|
await sleep();
|
|
73
198
|
process.exit(1);
|
|
74
199
|
}
|
|
75
200
|
|
|
76
201
|
if (!binaryPath) {
|
|
77
|
-
logger.error('
|
|
78
|
-
logger.debug('
|
|
202
|
+
logger.error('Could not obtain the BrowserStack Load Testing CLI binary: the download or extraction did not produce a usable binary. Re-run with DEBUG=true for details, or contact BrowserStack support if this persists.');
|
|
203
|
+
logger.debug('checkAndUpdateCli returned an empty binary path');
|
|
204
|
+
await reportFailureToLTS(config, ERROR_CODES.UNKNOWN, {reason: 'empty-binary-path'});
|
|
79
205
|
await sleep();
|
|
80
206
|
process.exit(1);
|
|
81
207
|
}
|
|
@@ -89,11 +215,53 @@ async function executeLoadTest(yargs) {
|
|
|
89
215
|
|
|
90
216
|
let isExiting = false;
|
|
91
217
|
|
|
92
|
-
// Promise that resolves when the child process exits
|
|
218
|
+
// Promise that resolves when the child process exits (or fails to spawn).
|
|
93
219
|
const childProcessPromise = new Promise((resolve) => {
|
|
94
|
-
|
|
95
|
-
|
|
220
|
+
let settled = false;
|
|
221
|
+
let errored = false;
|
|
222
|
+
const settle = (code) => {
|
|
223
|
+
if (settled) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
settled = true;
|
|
96
227
|
resolve(code);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// A failed spawn (binary missing, not executable, wrong arch) emits
|
|
231
|
+
// 'error' — without a listener Node throws an unhandled error and crashes
|
|
232
|
+
// the process with a raw stack trace (the SDK-6188 breakage class).
|
|
233
|
+
// Surface an actionable message and resolve with a deterministic code so
|
|
234
|
+
// the flow exits cleanly instead of hanging or crashing.
|
|
235
|
+
childProc.on('error', (err) => {
|
|
236
|
+
errored = true;
|
|
237
|
+
let code = 1;
|
|
238
|
+
if (err && err.code === 'ENOENT') {
|
|
239
|
+
code = 127;
|
|
240
|
+
logger.error(`Unable to launch the BrowserStack Load Testing CLI binary at ${binaryPath}. The download may be incomplete or corrupt — delete it (under ~/.browserstack/cli) and re-run.`);
|
|
241
|
+
} else if (err && err.code === 'EACCES') {
|
|
242
|
+
code = 126;
|
|
243
|
+
logger.error(`The BrowserStack Load Testing CLI binary at ${binaryPath} is not executable (permission denied). Check file permissions and re-run.`);
|
|
244
|
+
} else {
|
|
245
|
+
const {userMessage} = classify(err);
|
|
246
|
+
logger.error(`Failed to launch the Load Testing CLI: ${userMessage}`);
|
|
247
|
+
}
|
|
248
|
+
logger.debug(`Spawn error details: ${err && (err.stack || err.message)}`);
|
|
249
|
+
settle(code);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
childProc.on('close', (code) => {
|
|
253
|
+
// If the process failed to spawn, 'error' already reported the cause;
|
|
254
|
+
// don't emit a second, less-specific error line here.
|
|
255
|
+
if (!errored) {
|
|
256
|
+
if (code !== 0 && code !== null) {
|
|
257
|
+
// Promote a non-zero exit to an actionable, user-visible error
|
|
258
|
+
// (mirrors the automation flow, which logs non-zero exits at ERROR).
|
|
259
|
+
logger.error(messageForExitCode(code));
|
|
260
|
+
} else {
|
|
261
|
+
logger.debug(`${binaryPath} exited with code ${code}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
settle(code === null ? 1 : code);
|
|
97
265
|
});
|
|
98
266
|
});
|
|
99
267
|
|
|
@@ -118,13 +286,26 @@ async function executeLoadTest(yargs) {
|
|
|
118
286
|
// Wait for the child process to complete
|
|
119
287
|
const exitCode = await childProcessPromise;
|
|
120
288
|
|
|
289
|
+
// Report a failed run downstream (covers both a failed spawn — settled with
|
|
290
|
+
// 126/127 above — and a non-zero exit from the binary itself). Skip when the
|
|
291
|
+
// non-zero exit was caused by a forwarded signal (Ctrl+C / SIGTERM): that is
|
|
292
|
+
// a user-initiated cancellation, not a failure, and reporting it would emit a
|
|
293
|
+
// spurious LoadCliRunFailed.
|
|
294
|
+
if (exitCode !== 0 && !isExiting) {
|
|
295
|
+
await reportFailureToLTS(config, ERROR_CODES.UNKNOWN, {exitCode});
|
|
296
|
+
} else if (exitCode !== 0 && isExiting) {
|
|
297
|
+
logger.debug(`Load test cancelled by signal (exit code ${exitCode}); not reported as a failure.`);
|
|
298
|
+
}
|
|
299
|
+
|
|
121
300
|
// Exit with the same code as the child process
|
|
122
301
|
await sleep();
|
|
123
302
|
process.exit(exitCode);
|
|
124
303
|
|
|
125
304
|
} catch (error) {
|
|
126
|
-
|
|
127
|
-
logger.
|
|
305
|
+
const {code, userMessage} = classify(error);
|
|
306
|
+
logger.error(`Failed initiating load test: ${userMessage}`);
|
|
307
|
+
logger.debug(`Unexpected load error [${code}]: ${error && (error.stack || JSON.stringify(error))}`);
|
|
308
|
+
await reportFailureToLTS(config, code);
|
|
128
309
|
await sleep();
|
|
129
310
|
process.exit(1);
|
|
130
311
|
}
|