browserstack-node-sdk 1.62.0 → 1.63.1
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_0x3f7b22=a31_0x16aa;(function(_0x4a2d0b,_0x1c26a5){const _0x32be06=a31_0x16aa,_0x543ea6=_0x4a2d0b();while(!![]){try{const _0x25aee4=-parseInt(_0x32be06(0x1dd))/0x1+-parseInt(_0x32be06(0x201))/0x2*(-parseInt(_0x32be06(0x209))/0x3)+-parseInt(_0x32be06(0x1e1))/0x4+parseInt(_0x32be06(0x1f1))/0x5+-parseInt(_0x32be06(0x1ef))/0x6*(-parseInt(_0x32be06(0x1f6))/0x7)+parseInt(_0x32be06(0x208))/0x8+-parseInt(_0x32be06(0x1e0))/0x9*(parseInt(_0x32be06(0x1ec))/0xa);if(_0x25aee4===_0x1c26a5)break;else _0x543ea6['push'](_0x543ea6['shift']());}catch(_0x541949){_0x543ea6['push'](_0x543ea6['shift']());}}}(a31_0x4bb5,0x36b99));const path=require('path'),{requireModule,modifyCommand,getPlatformName,cleanupDrivers,isBrowserstackInfra}=require(a31_0x3f7b22(0x202)),constants=require(a31_0x3f7b22(0x1fe)),{isAccessibilityAutomationSession}=require(a31_0x3f7b22(0x1db)),RequestQueueHandler=require(a31_0x3f7b22(0x207)),{isTestObservabilitySession}=require(a31_0x3f7b22(0x1e2)),helper=require(a31_0x3f7b22(0x202)),PerformanceTester=require('../../helpers/performance/performance-tester'),PerformanceEvents=require(a31_0x3f7b22(0x1f8))[a31_0x3f7b22(0x1f4)],{commandRepository}=require(a31_0x3f7b22(0x1e7)),BrowserstackCLI=require(a31_0x3f7b22(0x1ff)),ClientTroubleShootingService=require(a31_0x3f7b22(0x1e8));class Launcher{constructor(_0x23e1b4,_0x5a9872,_0x51ac0a,_0x39ab57=[]){const _0x2911ba=a31_0x3f7b22,_0x9c97ab={'VnLer':'2|17|21|8|23|22|15|0|1|14|7|5|3|13|9|16|19|11|12|10|20|6|4|18','OkXRt':function(_0x3c2ee0){return _0x3c2ee0();},'dewnv':function(_0x115506){return _0x115506();}},_0x1ddd71=_0x9c97ab[_0x2911ba(0x1e3)]['split']('|');let _0x183cbc=0x0;while(!![]){switch(_0x1ddd71[_0x183cbc++]){case'0':this['_argv']=_0x39ab57;continue;case'1':this[_0x2911ba(0x203)]=_0x51ac0a;continue;case'2':this[_0x2911ba(0x1e5)]=_0x23e1b4;continue;case'3':global['testSuites']=0x0;continue;case'4':global[_0x2911ba(0x1eb)]={};continue;case'5':global[_0x2911ba(0x1ea)]=this['_configuration']['platformCaps']||{};continue;case'6':global[_0x2911ba(0x1f5)]=0x0;continue;case'7':this[_0x2911ba(0x1da)]=_0x9c97ab[_0x2911ba(0x1fb)](isAccessibilityAutomationSession);continue;case'8':this[_0x2911ba(0x204)]=_0x5a9872[_0x2911ba(0x200)];continue;case'9':global[_0x2911ba(0x1f0)]=0x0;continue;case'10':global[_0x2911ba(0x1df)]=0x0;continue;case'11':global[_0x2911ba(0x1fd)]=0x0;continue;case'12':global[_0x2911ba(0x1ed)]=0x0;continue;case'13':global[_0x2911ba(0x1e9)]=0x0;continue;case'14':this[_0x2911ba(0x1fa)]=_0x9c97ab[_0x2911ba(0x1fc)](isTestObservabilitySession);continue;case'15':global['__platform__']=this[_0x2911ba(0x20b)][_0x2911ba(0x1de)];continue;case'16':global[_0x2911ba(0x1e4)]=0x0;continue;case'17':this[_0x2911ba(0x20b)]=_0x5a9872[_0x2911ba(0x1f9)]||{};continue;case'18':!constants[_0x2911ba(0x1f7)][_0x2911ba(0x205)](_0x23e1b4)&&(commandRepository['setConfig'](_0x51ac0a),commandRepository[_0x2911ba(0x1f3)](_0x23e1b4));continue;case'19':global[_0x2911ba(0x1e6)]=0x0;continue;case'20':global['testsUnknown']=0x0;continue;case'21':this['_configuration'][_0x2911ba(0x20a)]=_0x23e1b4;continue;case'22':this[_0x2911ba(0x20c)]=this[_0x2911ba(0x20b)][_0x2911ba(0x1ee)];continue;case'23':this[_0x2911ba(0x1f2)]=_0x5a9872['formatter'];continue;}break;}}[a31_0x3f7b22(0x206)](_0x3eafd5,_0x26450d,_0x168c9c){const _0x4e5c24=a31_0x3f7b22,_0x3d5fed=_0x3eafd5[_0x4e5c24(0x1dc)];_0x3eafd5.resolvePaths=async function(){const pathResults=await _0x3d5fed.apply(this,arguments);if(!pathResults.requirePaths){pathResults.requirePaths=[];}pathResults.requirePaths=[path.join(__dirname,'../cucumber-js/test.setup.js')].concat(pathResults.requirePaths,path.join(__dirname,_0x168c9c));return pathResults;};const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;_0x26450d.push('--format'),_0x26450d.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;function a31_0x16aa(_0x311e84,_0x1c590){const _0x4bb5c3=a31_0x4bb5();return a31_0x16aa=function(_0x16aa6f,_0x526e7c){_0x16aa6f=_0x16aa6f-0x1da;let _0x4131b9=_0x4bb5c3[_0x16aa6f];return _0x4131b9;},a31_0x16aa(_0x311e84,_0x1c590);}function a31_0x4bb5(){const _0x3c5707=['1743iBdWNH','AI_ENABLED_FRAMEWORK','../../helpers/performance/constants','configuration','_testObservability','OkXRt','dewnv','testsSkipped','../utils/constants','../v2/browserstackCLI','mochaOpts','10BJmDln','../../helpers/helper','_bsConfig','_mochaOpts','includes','setupCucumber','../../helpers/test-observability/requestQueueHandler','2188656VrQxIh','102471oRJNCB','framework','_configuration','_capability','_accessibilityAutomation','../../helpers/accessibility-automation/helper','resolvePaths','335437UlsnxW','platform','testsUndefined','9QVTGgO','1152868qbhlLW','../../helpers/test-observability/utils','VnLer','testsFailed','_framework','testsPending','../../helpers/ai-sdk/autoHealHelper','../utils/clientTroubleshootingService','totalTests','__platformCaps','testsErrorMessage','174630WPtPlZ','testSuitesFailed','capability','2298rdcLzA','testsPassed','1627680hrdbEt','_formatter','setFramework','EVENTS','testsAmbiguous'];a31_0x4bb5=function(){return _0x3c5707;};return a31_0x4bb5();}
|
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_0x523a98=a32_0x4ac7;function a32_0x4ac7(_0x3ee5d9,_0x590462){const _0x9c2720=a32_0x9c27();return a32_0x4ac7=function(_0x4ac74e,_0x107724){_0x4ac74e=_0x4ac74e-0x1bf;let _0x1a10b2=_0x9c2720[_0x4ac74e];return _0x1a10b2;},a32_0x4ac7(_0x3ee5d9,_0x590462);}(function(_0x59130f,_0x2f6767){const _0x4980cf=a32_0x4ac7,_0x46cadb=_0x59130f();while(!![]){try{const _0x1d1165=parseInt(_0x4980cf(0x24a))/0x1+-parseInt(_0x4980cf(0x1d5))/0x2*(-parseInt(_0x4980cf(0x1e8))/0x3)+parseInt(_0x4980cf(0x1eb))/0x4+parseInt(_0x4980cf(0x1c1))/0x5*(-parseInt(_0x4980cf(0x23d))/0x6)+-parseInt(_0x4980cf(0x231))/0x7*(parseInt(_0x4980cf(0x203))/0x8)+-parseInt(_0x4980cf(0x1d1))/0x9*(parseInt(_0x4980cf(0x20f))/0xa)+-parseInt(_0x4980cf(0x1ec))/0xb;if(_0x1d1165===_0x2f6767)break;else _0x46cadb['push'](_0x46cadb['shift']());}catch(_0x4f692a){_0x46cadb['push'](_0x46cadb['shift']());}}}(a32_0x9c27,0xba3b0));function a32_0x9c27(){const _0x7100a5=['minTestedMajor','stack','xpGXN','ZOMYg','tqaDL','getExistingCliPath','Could\x20not\x20report\x20Load\x20Testing\x20failure\x20downstream:\x20','20whiauJ','\x20is\x20not\x20executable\x20(permission\x20denied).\x20Check\x20file\x20permissions\x20and\x20re-run.','rkdHt','UkTMu','SQyPa','join','race','setLTSSessionId','event_name','Authentication\x20incomplete.\x20Please\x20add\x20your\x20userName\x20and\x20accessKey\x20to\x20either\x20the\x20browserstack.yml\x20file\x20or\x20as\x20environment\x20variables,\x20then\x20try\x20running\x20the\x20command\x20again.','CFIfv','FheTN','CLI\x20binary\x20found,\x20Checking\x20for\x20CLI\x20updates','split','GXDOQ','QvryH',').\x20It\x20may\x20work;\x20if\x20you\x20hit\x20issues,\x20switch\x20to\x20a\x20validated\x20Node.js\x20version.','mOVdn','child_process','code','Load\x20test\x20cancelled\x20by\x20signal\x20(exit\x20code\x20','BnxhC','./loadUtils','HcwWX','Config\x20load\x20error\x20[','killed','SrXCg','pndnR','error','includes','feature','CLI\x20acquisition\x20failed\x20[','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.','QnGzI','28QMEQaP','maxTestedMajor','winstonLogger',']:\x20','./loadErrors','cwd',',\x20forwarding\x20to\x20child\x20process...','.\x20The\x20download\x20may\x20be\x20incomplete\x20or\x20corrupt\x20—\x20delete\x20it\x20(under\x20~/.browserstack/cli)\x20and\x20re-run.','ENOENT','assign','Loading\x20configuration\x20using\x20environment\x20variables\x20if\x20available.','EACCES','63144afvDaI','SIGQUIT','BROWSERSTACK_USERNAME','../../helpers/helper','accessKey','XnCPF','xlvme','SAkDZ','../../helpers/logger','close','DfqRw','Failed\x20to\x20determine\x20CLI\x20directory','message','1036049Jgfzsd','\x20load\x20','hhqFR','zgbvI','hardMinMajor','load','DurXG','true','5oBowmj','Spawning:\x20','namID','empty-binary-path','Unexpected\x20load\x20error\x20[','NNdeQ','versions','DnTRV','\x20is\x20newer\x20than\x20the\x20latest\x20version\x20validated\x20for\x20BrowserStack\x20Load\x20Testing\x20(up\x20to\x20Node\x20','Received\x20','The\x20BrowserStack\x20Load\x20Testing\x20CLI\x20binary\x20at\x20','QumFJ','stringify','zhdRl','Node.js\x20v','\x20exited\x20with\x20code\x20','6365646TKQojD','exit','debug','slice','12570RJFnvG','../utils/constants','warn','Failed\x20to\x20read\x20Load\x20Testing\x20configuration\x20at\x20','catch','node','GEHkl','CONFIG_PARSE','nxMct','LTS','jAXLB','inherit','apwWQ','EUuae','kill','XJbDW','YVEJj','\x20is\x20older\x20than\x20the\x20oldest\x20version\x20validated\x20for\x20BrowserStack\x20Load\x20Testing\x20(Node\x20','checkAndUpdateCli','699iuFvNy','CDvyR','argv','1568304ahpHDS','1247642HtYbLp','CLI\x20binary\x20not\x20found,\x20downloading\x20latest\x20version','vuvfU','SIGINT','asrPr','McMjw','env','../v2/cliUtils','ifoxf','then','Failed\x20to\x20load\x20Load\x20Testing\x20configuration:\x20','BROWSERSTACK_ACCESS_KEY','jOdlI','rUmUt','detectedNodeMajor','FS_PERMISSION','mvtgP','Unable\x20to\x20launch\x20the\x20BrowserStack\x20Load\x20Testing\x20CLI\x20binary\x20at\x20','KRVNB','pUHhF','mODwz','LoadCliRunFailed','checkAndUpdateCli\x20returned\x20an\x20empty\x20binary\x20path','1182392yaAVTK','UNKNOWN','isFinite','userName','Failed\x20to\x20launch\x20the\x20Load\x20Testing\x20CLI:\x20'];a32_0x9c27=function(){return _0x7100a5;};return a32_0x9c27();}const {spawn}=require(a32_0x523a98(0x221)),path=require('path'),helper=require(a32_0x523a98(0x240)),CLIUtils=require(a32_0x523a98(0x1f3)),LoadTestModule=require('../v2/modules/loadTestModule'),{getLoadConfigPath,sleep}=require(a32_0x523a98(0x225)),{classify,messageForExitCode,runtimeNotSupportedMessage,LT_EXIT_UNSUPPORTED_RUNTIME,ERROR_CODES}=require(a32_0x523a98(0x235)),{LT_SUPPORTED_NODE}=require(a32_0x523a98(0x1d6)),logger=require(a32_0x523a98(0x245))[a32_0x523a98(0x233)];async function reportFailureToLTS(_0x57f3a2,_0x4b6431,_0x2b2703={}){const _0x27609c=a32_0x523a98,_0x4a793e={'jOdlI':function(_0x50a4f2,_0x211fd3,_0x1b790f){return _0x50a4f2(_0x211fd3,_0x1b790f);},'mOVdn':'Skipping\x20downstream\x20LT\x20failure\x20report:\x20credentials\x20unavailable.','fEhnR':_0x27609c(0x1de),'namID':_0x27609c(0x201),'ooqus':function(_0x56e9b7,_0x5b3617){return _0x56e9b7(_0x5b3617);}};if(!_0x57f3a2||!_0x57f3a2[_0x27609c(0x206)]||!_0x57f3a2['accessKey']){logger[_0x27609c(0x1d3)](_0x4a793e[_0x27609c(0x220)]);return;}const _0x1fa607={};_0x1fa607[_0x27609c(0x22d)]=_0x4a793e['fEhnR'],_0x1fa607[_0x27609c(0x217)]=_0x4a793e[_0x27609c(0x1c3)],_0x1fa607['errorCode']=_0x4b6431||ERROR_CODES['UNKNOWN'];const _0x275bd7=Object[_0x27609c(0x23a)](_0x1fa607,_0x2b2703),_0x2dbb96=Promise['resolve']()[_0x27609c(0x1f5)](()=>helper['sendToEDS'](_0x275bd7,_0x57f3a2||{}))[_0x27609c(0x1d9)](_0x6e576c=>{const _0x5b0fcc=_0x27609c;logger[_0x5b0fcc(0x1d7)](_0x5b0fcc(0x20e)+(_0x6e576c&&_0x6e576c[_0x5b0fcc(0x249)]));});let _0x5dada5;const _0x1bc656=new Promise(_0x1e5310=>{const _0xf7e54c=_0x27609c;_0x5dada5=_0x4a793e[_0xf7e54c(0x1f8)](setTimeout,_0x1e5310,0xbb8);});await Promise[_0x27609c(0x215)]([_0x2dbb96,_0x1bc656]),_0x4a793e['ooqus'](clearTimeout,_0x5dada5);}async function assertSupportedRuntime(_0x326ee0){const _0xa2aca1=a32_0x523a98,_0x459268={'XJbDW':function(_0x1fe064,_0x39edf9){return _0x1fe064(_0x39edf9);},'asrPr':_0xa2aca1(0x1c0),'rUmUt':'yes','tqaDL':function(_0xfaf62,_0x374097){return _0xfaf62||_0x374097;},'FEevH':function(_0x281003,_0xdc589e,_0x3b0c35){return _0x281003(_0xdc589e,_0x3b0c35);},'EUuae':function(_0x15991e,_0xcefec3){return _0x15991e(_0xcefec3);},'ZOMYg':function(_0x2c583f,_0x3c2d5b){return _0x2c583f<_0x3c2d5b;},'QvryH':function(_0x15980a,_0x2453e9,_0x1f3a60){return _0x15980a(_0x2453e9,_0x1f3a60);},'xlvme':function(_0x4a70cf,_0x50cdd8,_0x42ba0a,_0x203592){return _0x4a70cf(_0x50cdd8,_0x42ba0a,_0x203592);},'SAkDZ':function(_0x4d7ccb){return _0x4d7ccb();},'EDieR':function(_0x32ae18,_0x278317){return _0x32ae18<_0x278317;},'SQyPa':function(_0x2514d7,_0x15aee8){return _0x2514d7>_0x15aee8;}},_0x96b576=_0x459268[_0xa2aca1(0x1e4)](String,process['env']['BROWSERSTACK_SKIP_NODE_CHECK']||'')['toLowerCase']();if([_0x459268[_0xa2aca1(0x1f0)],'1',_0x459268[_0xa2aca1(0x1f9)]][_0xa2aca1(0x22c)](_0x96b576))return;const _0x48ca63=_0x459268[_0xa2aca1(0x20c)](LT_SUPPORTED_NODE,{}),_0x3e6d91=_0x459268['FEevH'](parseInt,_0x459268[_0xa2aca1(0x1e2)](String,process[_0xa2aca1(0x1c7)][_0xa2aca1(0x1da)])[_0xa2aca1(0x21c)]('.')[0x0],0xa);if(!Number[_0xa2aca1(0x205)](_0x3e6d91))return;if(_0x48ca63[_0xa2aca1(0x24e)]&&_0x459268[_0xa2aca1(0x20b)](_0x3e6d91,_0x48ca63[_0xa2aca1(0x24e)])){logger[_0xa2aca1(0x22b)](_0x459268[_0xa2aca1(0x21e)](runtimeNotSupportedMessage,_0x3e6d91,_0x48ca63));const _0x31f265={};_0x31f265[_0xa2aca1(0x1fa)]=_0x3e6d91,await _0x459268[_0xa2aca1(0x243)](reportFailureToLTS,_0x326ee0,ERROR_CODES['UNSUPPORTED_RUNTIME'],_0x31f265),await _0x459268[_0xa2aca1(0x244)](sleep),process['exit'](LT_EXIT_UNSUPPORTED_RUNTIME);}if(_0x48ca63[_0xa2aca1(0x208)]&&_0x459268['EDieR'](_0x3e6d91,_0x48ca63[_0xa2aca1(0x208)]))logger[_0xa2aca1(0x1d7)](_0xa2aca1(0x1cf)+_0x3e6d91+_0xa2aca1(0x1e6)+_0x48ca63[_0xa2aca1(0x208)]+_0xa2aca1(0x21f));else _0x48ca63['maxTestedMajor']&&_0x459268[_0xa2aca1(0x213)](_0x3e6d91,_0x48ca63[_0xa2aca1(0x232)])&&logger['warn']('Node.js\x20v'+_0x3e6d91+_0xa2aca1(0x1c9)+_0x48ca63['maxTestedMajor']+_0xa2aca1(0x21f));}async function executeLoadTest(_0x429cbc){const _0x4e89ff=a32_0x523a98,_0x27088f={'zgbvI':function(_0x5adae1,_0x3ebc01){return _0x5adae1===_0x3ebc01;},'ifoxf':_0x4e89ff(0x239),'nmdgO':_0x4e89ff(0x23c),'zhdRl':function(_0x45f18a,_0x357bb3){return _0x45f18a(_0x357bb3);},'FheTN':function(_0x8e8d4a,_0x3b12ee){return _0x8e8d4a(_0x3b12ee);},'xpGXN':function(_0x3017c9,_0x26b566){return _0x3017c9!==_0x26b566;},'QumFJ':function(_0x2ddecb,_0x23dde2){return _0x2ddecb!==_0x23dde2;},'McMjw':function(_0x1729f7,_0x2e0da4){return _0x1729f7(_0x2e0da4);},'pUHhF':function(_0x18729d,_0x61d380){return _0x18729d(_0x61d380);},'QnGzI':function(_0xc366a1,_0x27a46f){return _0xc366a1(_0x27a46f);},'CDvyR':_0x4e89ff(0x22b),'GvqkC':_0x4e89ff(0x246),'nxMct':'Waiting\x20for\x20child\x20process\x20to\x20exit...','DurXG':_0x4e89ff(0x23b),'BnxhC':function(_0x264f88,_0x4d9644,_0x3ac974){return _0x264f88(_0x4d9644,_0x3ac974);},'DfqRw':function(_0x1f9eaa){return _0x1f9eaa();},'BmVfO':function(_0x26ffed){return _0x26ffed();},'tAZAK':_0x4e89ff(0x218),'BiSdK':function(_0x4768a2,_0x2bdc41,_0x3dca55,_0x245edc){return _0x4768a2(_0x2bdc41,_0x3dca55,_0x245edc);},'apwWQ':'missing-credentials','vuvfU':function(_0x1c09f1){return _0x1c09f1();},'UkTMu':_0x4e89ff(0x248),'GEHkl':function(_0x2c7e97,_0x50af8b,_0x209fd4,_0x350acc){return _0x2c7e97(_0x50af8b,_0x209fd4,_0x350acc);},'jAXLB':'no-writable-cli-dir','fqzjJ':_0x4e89ff(0x1ed),'DnTRV':_0x4e89ff(0x21b),'CFIfv':'0|4|3|2|1','KRVNB':_0x4e89ff(0x22f),'mODwz':function(_0x400fda){return _0x400fda();},'ZbAQZ':function(_0x30bd97,_0x59f147,_0xa35843,_0x1b607a){return _0x30bd97(_0x59f147,_0xa35843,_0x1b607a);},'zLLQl':_0x4e89ff(0x1c4),'rkdHt':_0x4e89ff(0x202),'dwrIV':function(_0x3201ce,_0x4b0c7a,_0x5da344,_0xaf53da){return _0x3201ce(_0x4b0c7a,_0x5da344,_0xaf53da);},'SrXCg':_0x4e89ff(0x24f),'XnCPF':_0x4e89ff(0x1e0),'hhqFR':_0x4e89ff(0x1ef),'mvtgP':'SIGTERM','HcwWX':_0x4e89ff(0x23e),'YVEJj':'SIGHUP','pndnR':function(_0x3eaff3,_0x332b27,_0x1ccb51,_0x811224){return _0x3eaff3(_0x332b27,_0x1ccb51,_0x811224);},'GXDOQ':function(_0x2b95cd,_0x59f100){return _0x2b95cd(_0x59f100);}};let _0xd431f2={};try{const _0x4a42c3=process[_0x4e89ff(0x1ea)][_0x4e89ff(0x1d4)](0x2),_0x4efe65=_0x4a42c3['slice'](0x1);logger[_0x4e89ff(0x1d3)]('Executing\x20load\x20test\x20with\x20arguments:\x20'+_0x4efe65);try{logger['debug'](_0x27088f[_0x4e89ff(0x1bf)]);const _0x5d7672={};_0x5d7672[_0x4e89ff(0x206)]=process[_0x4e89ff(0x1f2)][_0x4e89ff(0x23f)]||process['env']['BROWSERSTACK_USER'],_0x5d7672[_0x4e89ff(0x241)]=process[_0x4e89ff(0x1f2)][_0x4e89ff(0x1f7)]||process[_0x4e89ff(0x1f2)]['BROWSERSTACK_ACCESSKEY'],_0xd431f2=_0x5d7672;if(!_0xd431f2[_0x4e89ff(0x206)]||!_0xd431f2[_0x4e89ff(0x241)]){const _0x9f8aa=_0x27088f[_0x4e89ff(0x230)](getLoadConfigPath,_0x429cbc[_0x4e89ff(0x1ea)]);logger['debug']('Configuration\x20path:\x20'+_0x9f8aa),_0x9f8aa?(_0xd431f2=helper['readConfig'](_0x9f8aa),_0xd431f2&&_0xd431f2[_0x4e89ff(0x22b)]&&(logger['error'](_0x4e89ff(0x1d8)+_0x9f8aa+':\x20'+_0xd431f2[_0x4e89ff(0x22b)]),await _0x27088f[_0x4e89ff(0x224)](reportFailureToLTS,_0xd431f2,ERROR_CODES[_0x4e89ff(0x1dc)]),await _0x27088f[_0x4e89ff(0x247)](sleep),process[_0x4e89ff(0x1d2)](0x1))):logger['info']('No\x20browserstack-load.yml\x20/\x20browserstack.yml\x20found\x20in\x20'+process[_0x4e89ff(0x236)]()+';\x20relying\x20on\x20environment\x20variables\x20for\x20credentials.');}}catch(_0x1b91a1){const {userMessage:_0x1ce28c,code:_0x75683}=_0x27088f[_0x4e89ff(0x1ff)](classify,_0x1b91a1);logger['error'](_0x4e89ff(0x1f6)+_0x1ce28c),logger['debug'](_0x4e89ff(0x227)+_0x75683+_0x4e89ff(0x234)+(_0x1b91a1&&(_0x1b91a1[_0x4e89ff(0x209)]||JSON['stringify'](_0x1b91a1)))),await _0x27088f[_0x4e89ff(0x224)](reportFailureToLTS,_0xd431f2,_0x75683),await _0x27088f['BmVfO'](sleep),process['exit'](0x1);}(!_0xd431f2[_0x4e89ff(0x206)]||!_0xd431f2['accessKey'])&&(logger[_0x4e89ff(0x22b)](_0x27088f['tAZAK']),await _0x27088f['BiSdK'](reportFailureToLTS,_0xd431f2,ERROR_CODES['AUTH_INVALID'],{'reason':_0x27088f[_0x4e89ff(0x1e1)]}),await _0x27088f[_0x4e89ff(0x1ee)](sleep),process[_0x4e89ff(0x1d2)](0x1));await _0x27088f[_0x4e89ff(0x21a)](assertSupportedRuntime,_0xd431f2);try{await LoadTestModule[_0x4e89ff(0x216)](_0xd431f2);}catch(_0x3bd8a5){logger[_0x4e89ff(0x1d3)]('LTS\x20session\x20linking\x20skipped:\x20'+(_0x3bd8a5&&_0x3bd8a5['message']));}const _0x13986c=CLIUtils['getCliDir']();!_0x13986c&&(logger['error'](_0x27088f[_0x4e89ff(0x212)]),await _0x27088f[_0x4e89ff(0x1db)](reportFailureToLTS,_0xd431f2,ERROR_CODES[_0x4e89ff(0x1fb)],{'reason':_0x27088f[_0x4e89ff(0x1df)]}),await _0x27088f[_0x4e89ff(0x1ee)](sleep),process['exit'](0x1));let _0x532b04=CLIUtils[_0x4e89ff(0x20d)](_0x13986c);try{!_0x532b04?(logger[_0x4e89ff(0x1d3)](_0x27088f['fqzjJ']),_0x532b04=await CLIUtils[_0x4e89ff(0x1e7)]('',_0x13986c,_0xd431f2)):(logger[_0x4e89ff(0x1d3)](_0x27088f[_0x4e89ff(0x1c8)]),_0x532b04=await CLIUtils[_0x4e89ff(0x1e7)](_0x532b04,_0x13986c,_0xd431f2));}catch(_0x519fda){const {code:_0x183fd7,userMessage:_0x3c9e73}=_0x27088f[_0x4e89ff(0x1ce)](classify,_0x519fda);logger[_0x4e89ff(0x22b)](_0x3c9e73),logger[_0x4e89ff(0x1d3)](_0x4e89ff(0x22e)+_0x183fd7+_0x4e89ff(0x234)+(_0x519fda&&(_0x519fda[_0x4e89ff(0x209)]||_0x519fda[_0x4e89ff(0x249)]||JSON['stringify'](_0x519fda)))),await _0x27088f[_0x4e89ff(0x224)](reportFailureToLTS,_0xd431f2,_0x183fd7),await _0x27088f[_0x4e89ff(0x247)](sleep),process['exit'](0x1);}if(!_0x532b04){const _0x3f9818=_0x27088f[_0x4e89ff(0x219)][_0x4e89ff(0x21c)]('|');let _0x5c381e=0x0;while(!![]){switch(_0x3f9818[_0x5c381e++]){case'0':logger[_0x4e89ff(0x22b)](_0x27088f[_0x4e89ff(0x1fe)]);continue;case'1':process[_0x4e89ff(0x1d2)](0x1);continue;case'2':await _0x27088f[_0x4e89ff(0x200)](sleep);continue;case'3':await _0x27088f['ZbAQZ'](reportFailureToLTS,_0xd431f2,ERROR_CODES['UNKNOWN'],{'reason':_0x27088f['zLLQl']});continue;case'4':logger[_0x4e89ff(0x1d3)](_0x27088f[_0x4e89ff(0x211)]);continue;}break;}}logger[_0x4e89ff(0x1d3)](_0x4e89ff(0x1c2)+_0x532b04+_0x4e89ff(0x24b)+_0x4efe65[_0x4e89ff(0x214)]('\x20'));const _0x1df844=_0x27088f['dwrIV'](spawn,_0x532b04,[_0x27088f[_0x4e89ff(0x229)],..._0x4efe65],{'stdio':_0x27088f[_0x4e89ff(0x242)]});let _0x3bd821=![];const _0x2a05ff=new Promise(_0xec94a5=>{const _0x15b35d=_0x4e89ff,_0x162b93={'NNdeQ':function(_0x25e957,_0x35ee62){return _0x27088f['QnGzI'](_0x25e957,_0x35ee62);}};let _0x47eb8d=![],_0x23a2ff=![];const _0x110c31=_0x5b7fb3=>{const _0x47e805=a32_0x4ac7;if(_0x47eb8d)return;_0x47eb8d=!![],_0x162b93[_0x47e805(0x1c6)](_0xec94a5,_0x5b7fb3);};_0x1df844['on'](_0x27088f[_0x15b35d(0x1e9)],_0x442521=>{const _0x209445=_0x15b35d;_0x23a2ff=!![];let _0x316619=0x1;if(_0x442521&&_0x27088f[_0x209445(0x24d)](_0x442521[_0x209445(0x222)],_0x27088f[_0x209445(0x1f4)]))_0x316619=0x7f,logger[_0x209445(0x22b)](_0x209445(0x1fd)+_0x532b04+_0x209445(0x238));else{if(_0x442521&&_0x27088f['zgbvI'](_0x442521[_0x209445(0x222)],_0x27088f['nmdgO']))_0x316619=0x7e,logger[_0x209445(0x22b)](_0x209445(0x1cb)+_0x532b04+_0x209445(0x210));else{const {userMessage:_0x4d07ac}=_0x27088f[_0x209445(0x1ce)](classify,_0x442521);logger[_0x209445(0x22b)](_0x209445(0x207)+_0x4d07ac);}}logger[_0x209445(0x1d3)]('Spawn\x20error\x20details:\x20'+(_0x442521&&(_0x442521['stack']||_0x442521['message']))),_0x27088f[_0x209445(0x21a)](_0x110c31,_0x316619);}),_0x1df844['on'](_0x27088f['GvqkC'],_0x48411d=>{const _0x5deabf=_0x15b35d;!_0x23a2ff&&(_0x27088f[_0x5deabf(0x20a)](_0x48411d,0x0)&&_0x27088f[_0x5deabf(0x1cc)](_0x48411d,null)?logger[_0x5deabf(0x22b)](_0x27088f[_0x5deabf(0x1f1)](messageForExitCode,_0x48411d)):logger[_0x5deabf(0x1d3)](_0x532b04+_0x5deabf(0x1d0)+_0x48411d)),_0x27088f[_0x5deabf(0x1ff)](_0x110c31,_0x27088f[_0x5deabf(0x24d)](_0x48411d,null)?0x1:_0x48411d);});});[_0x27088f[_0x4e89ff(0x24c)],_0x27088f[_0x4e89ff(0x1fc)],_0x27088f[_0x4e89ff(0x226)],_0x27088f[_0x4e89ff(0x1e5)]]['forEach'](_0x3d2a5d=>{process['on'](_0x3d2a5d,()=>{const _0x2b136c=a32_0x4ac7;if(_0x3bd821)return;_0x3bd821=!![],logger[_0x2b136c(0x1d3)](_0x2b136c(0x1ca)+_0x3d2a5d+_0x2b136c(0x237)),_0x1df844&&!_0x1df844[_0x2b136c(0x228)]&&(_0x1df844[_0x2b136c(0x1e3)](_0x3d2a5d),logger[_0x2b136c(0x1d3)](_0x27088f[_0x2b136c(0x1dd)]));});});const _0x1fdb0c=await _0x2a05ff;if(_0x27088f[_0x4e89ff(0x1cc)](_0x1fdb0c,0x0)&&!_0x3bd821){const _0x267da0={};_0x267da0['exitCode']=_0x1fdb0c,await _0x27088f[_0x4e89ff(0x22a)](reportFailureToLTS,_0xd431f2,ERROR_CODES[_0x4e89ff(0x204)],_0x267da0);}else _0x27088f[_0x4e89ff(0x1cc)](_0x1fdb0c,0x0)&&_0x3bd821&&logger[_0x4e89ff(0x1d3)](_0x4e89ff(0x223)+_0x1fdb0c+');\x20not\x20reported\x20as\x20a\x20failure.');await _0x27088f[_0x4e89ff(0x1ee)](sleep),process[_0x4e89ff(0x1d2)](_0x1fdb0c);}catch(_0x4e8f5a){const {code:_0x59eb43,userMessage:_0x205aa6}=_0x27088f[_0x4e89ff(0x21d)](classify,_0x4e8f5a);logger[_0x4e89ff(0x22b)]('Failed\x20initiating\x20load\x20test:\x20'+_0x205aa6),logger[_0x4e89ff(0x1d3)](_0x4e89ff(0x1c5)+_0x59eb43+']:\x20'+(_0x4e8f5a&&(_0x4e8f5a[_0x4e89ff(0x209)]||JSON[_0x4e89ff(0x1cd)](_0x4e8f5a)))),await _0x27088f[_0x4e89ff(0x224)](reportFailureToLTS,_0xd431f2,_0x59eb43),await _0x27088f['mODwz'](sleep),process[_0x4e89ff(0x1d2)](0x1);}}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
|
}
|