browserstack-node-sdk 1.61.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.
Files changed (222) hide show
  1. package/ats/src/cloudproviders/AWS.js +1 -1
  2. package/ats/src/cloudproviders/Azure.js +1 -1
  3. package/ats/src/cloudproviders/CloudProvider.js +1 -1
  4. package/ats/src/cloudproviders/GoogleCloudProvider.js +1 -1
  5. package/ats/src/cloudproviders/utils.js +1 -1
  6. package/ats/src/commands/configure.js +1 -1
  7. package/ats/src/commands/connect.js +1 -1
  8. package/ats/src/commands/connect_commands/grid.js +1 -1
  9. package/ats/src/commands/create.js +1 -1
  10. package/ats/src/commands/create_commands/grid.js +1 -1
  11. package/ats/src/commands/delete.js +1 -1
  12. package/ats/src/commands/delete_commands/grid.js +1 -1
  13. package/ats/src/commands/init.js +1 -1
  14. package/ats/src/commands/list.js +1 -1
  15. package/ats/src/commands/list_commands/grid_profiles.js +1 -1
  16. package/ats/src/commands/list_commands/grids.js +1 -1
  17. package/ats/src/commands/precheck.js +1 -1
  18. package/ats/src/commands/precheck_commands/setup_precheck.js +1 -1
  19. package/ats/src/commands/start.js +1 -1
  20. package/ats/src/commands/start_commands/grid.js +1 -1
  21. package/ats/src/commands/stop.js +1 -1
  22. package/ats/src/commands/stop_commands/grid.js +1 -1
  23. package/ats/src/config/constants.js +1 -1
  24. package/ats/src/config/logger.js +1 -1
  25. package/ats/src/index.js +1 -1
  26. package/ats/src/utils/AWSUtils.js +1 -1
  27. package/ats/src/utils/createAutoscalerStack.js +1 -1
  28. package/ats/src/utils/createClusterStack.js +1 -1
  29. package/ats/src/utils/createHubHaStack.js +1 -1
  30. package/ats/src/utils/createk8sClient.js +1 -1
  31. package/ats/src/utils/deleteEFSMountTargets.js +1 -1
  32. package/ats/src/utils/deleteStack.js +1 -1
  33. package/ats/src/utils/describeStack.js +1 -1
  34. package/ats/src/utils/gridComponents.js +1 -1
  35. package/ats/src/utils/hstUtils.js +1 -1
  36. package/ats/src/utils/instrumentationUtils.js +1 -1
  37. package/ats/src/utils/userInput.js +1 -1
  38. package/ats/src/utils/utilityMethods.js +1 -1
  39. package/ats/src/utils/webSocketUtils.js +1 -1
  40. package/browserstack.pw.yml.sample +10 -0
  41. package/browserstack.yml.sample +10 -0
  42. package/package.json +1 -1
  43. package/src/ai-sdk-node/bundle.js +1 -1
  44. package/src/bin/codeceptjs/BrowserStackPlugin.js +1 -1
  45. package/src/bin/codeceptjs/command.js +1 -1
  46. package/src/bin/codeceptjs/helper.js +1 -1
  47. package/src/bin/codeceptjs/o11yHelper.js +1 -1
  48. package/src/bin/cucumber-js/command.js +1 -1
  49. package/src/bin/cucumber-js/formatter/custom_formatter.js +1 -1
  50. package/src/bin/cucumber-js/formatter/custom_formatter_old_versions.js +1 -1
  51. package/src/bin/cucumber-js/test-observability.js +1 -1
  52. package/src/bin/cucumber-js/test.setup.js +1 -1
  53. package/src/bin/cucumber-js/test_old.setup.js +1 -1
  54. package/src/bin/cucumber-js/timeout.setup.js +1 -1
  55. package/src/bin/integrations/command.js +1 -1
  56. package/src/bin/integrations/constants.js +1 -1
  57. package/src/bin/jasmine/bstack-reporter/customReporter.js +1 -1
  58. package/src/bin/jasmine/command.js +1 -1
  59. package/src/bin/jasmine/test.setup.js +1 -1
  60. package/src/bin/jasmine/testRunMap.js +1 -1
  61. package/src/bin/jest/command.js +1 -1
  62. package/src/bin/jest/customImplements/customCircus.js +1 -1
  63. package/src/bin/jest/customImplements/customEnvironment.js +1 -1
  64. package/src/bin/jest/customImplements/customJestAdapterInit.js +1 -1
  65. package/src/bin/jest/customImplements/customSequencer.js +1 -1
  66. package/src/bin/jest/customImplements/customTestRunnerTemplate.js +1 -1
  67. package/src/bin/jest/jest.setup.js +1 -1
  68. package/src/bin/jest/test-observability/data-hooks.js +1 -1
  69. package/src/bin/jest/test-observability/helper.js +1 -1
  70. package/src/bin/jest/test-observability/obsReporter.js +1 -1
  71. package/src/bin/jest/test-observability/test-details.js +1 -1
  72. package/src/bin/jest/test.setup.js +1 -1
  73. package/src/bin/jest/test_before.setup.js +1 -1
  74. package/src/bin/launcher/launcher.js +1 -1
  75. package/src/bin/load/index.js +1 -1
  76. package/src/bin/load/load/index.js +193 -12
  77. package/src/bin/load/load/loadErrors.js +248 -0
  78. package/src/bin/load/loadErrors.js +1 -0
  79. package/src/bin/load/loadUtils.js +1 -1
  80. package/src/bin/mocha/accessibility-automation/helper.js +1 -1
  81. package/src/bin/mocha/bstack-reporter/customReporter.js +1 -1
  82. package/src/bin/mocha/command.js +1 -1
  83. package/src/bin/mocha/test-observability/builderPatch.js +1 -1
  84. package/src/bin/mocha/test-observability/data-hooks.js +1 -1
  85. package/src/bin/mocha/test-observability/mochaUtils.js +1 -1
  86. package/src/bin/mocha/test.setup.js +1 -1
  87. package/src/bin/newman/command.js +1 -1
  88. package/src/bin/newman/helper.js +1 -1
  89. package/src/bin/newman/reporter/index.js +1 -1
  90. package/src/bin/newman/scriptRunner.js +1 -1
  91. package/src/bin/nightwatch/command.js +1 -1
  92. package/src/bin/playwright/accessibility-helper.js +1 -1
  93. package/src/bin/playwright/command.js +1 -1
  94. package/src/bin/playwright/globalSetup.js +1 -1
  95. package/src/bin/playwright/mock-process.js +1 -1
  96. package/src/bin/playwright/modifyPlaywrightConf.js +1 -1
  97. package/src/bin/playwright/patches.js +1 -1
  98. package/src/bin/playwright/reporter/pwUtils.js +1 -1
  99. package/src/bin/playwright/reporter/reporter.js +1 -1
  100. package/src/bin/playwright/reporter/test-details.js +1 -1
  101. package/src/bin/playwright/sessionDetails.js +1 -1
  102. package/src/bin/puppeteer/patches.js +1 -1
  103. package/src/bin/puppeteer/sessionDetails.js +1 -1
  104. package/src/bin/puppeteer/test.setup.js +1 -1
  105. package/src/bin/runner.js +1 -1
  106. package/src/bin/setup.js +1 -1
  107. package/src/bin/test-runner/index.js +1 -1
  108. package/src/bin/test-runner/runTest.js +1 -1
  109. package/src/bin/test-runner/testWorker.js +1 -1
  110. package/src/bin/testcafe/a11y-runner.js +1 -1
  111. package/src/bin/testcafe/command.js +1 -1
  112. package/src/bin/testcafe/reporter/index.js +1 -1
  113. package/src/bin/testcafe/reporter/tcUtils.js +1 -1
  114. package/src/bin/testcafe/session-registry.js +1 -1
  115. package/src/bin/testcafe/stdout-interceptor.js +1 -1
  116. package/src/bin/testcafe/testcafe-action-patcher.js +1 -1
  117. package/src/bin/testcafe/w3c-driver.js +1 -1
  118. package/src/bin/utils/apiUtilityMethods.js +1 -1
  119. package/src/bin/utils/clientTroubleshootingService.js +1 -1
  120. package/src/bin/utils/constants.js +1 -1
  121. package/src/bin/utils/log4jsAppender.js +1 -1
  122. package/src/bin/utils/logPatcher.js +1 -1
  123. package/src/bin/utils/logReportingAPI.js +1 -1
  124. package/src/bin/utils/playwright-patcher.js +1 -1
  125. package/src/bin/utils/puppeteer-patcher.js +1 -1
  126. package/src/bin/utils/sharedPlaywrightSessionDetails.js +1 -1
  127. package/src/bin/utils/sharedUtils.js +1 -1
  128. package/src/bin/v2/TestInfo.js +1 -1
  129. package/src/bin/v2/browserstackCLI.js +1 -1
  130. package/src/bin/v2/cliUtils.js +1 -1
  131. package/src/bin/v2/customTagManager.js +1 -1
  132. package/src/bin/v2/eventDispatcher.js +1 -1
  133. package/src/bin/v2/framework/automationFramework.js +1 -1
  134. package/src/bin/v2/framework/constants/automationFrameworkConstants.js +1 -1
  135. package/src/bin/v2/framework/constants/testFrameworkConstants.js +1 -1
  136. package/src/bin/v2/framework/cucumberTestFramework.js +1 -1
  137. package/src/bin/v2/framework/jestTestFramework.js +1 -1
  138. package/src/bin/v2/framework/newmanTestFramework.js +1 -1
  139. package/src/bin/v2/framework/playwrightAutomationFramework.js +1 -1
  140. package/src/bin/v2/framework/playwrightTestFramework.js +1 -1
  141. package/src/bin/v2/framework/puppeteerAutomationFramework.js +1 -1
  142. package/src/bin/v2/framework/testFramework.js +1 -1
  143. package/src/bin/v2/framework/testcafeAutomationFramework.js +1 -1
  144. package/src/bin/v2/framework/testcafeTestFramework.js +1 -1
  145. package/src/bin/v2/grpcClient.js +1 -1
  146. package/src/bin/v2/instances/automationFrameworkInstance.js +1 -1
  147. package/src/bin/v2/instances/testFrameworkInstance.js +1 -1
  148. package/src/bin/v2/instances/trackedContext.js +1 -1
  149. package/src/bin/v2/instances/trackedInstance.js +1 -1
  150. package/src/bin/v2/modules/accessibilityModule.js +1 -1
  151. package/src/bin/v2/modules/baseModule.js +1 -1
  152. package/src/bin/v2/modules/loadTestModule.js +1 -1
  153. package/src/bin/v2/modules/observabilityModule.js +1 -1
  154. package/src/bin/v2/modules/playwrightDriverModule.js +1 -1
  155. package/src/bin/v2/modules/puppeteerDriverModule.js +1 -1
  156. package/src/bin/v2/modules/testcafeDriverModule.js +1 -1
  157. package/src/bin/v2/modules/testhubModule.js +1 -1
  158. package/src/bin/v2/sdkErrorHandler.js +1 -0
  159. package/src/bin/v2/state/automationFrameworkState.js +1 -1
  160. package/src/bin/v2/state/hookState.js +1 -1
  161. package/src/bin/v2/state/testFrameworkState.js +1 -1
  162. package/src/bin/v2/uploadAttachmentsManager.js +1 -1
  163. package/src/bin/v2/utils/cucumber-utils.js +1 -1
  164. package/src/bin/v2/utils/jest-utils.js +1 -1
  165. package/src/bin/vanilla-js/command.js +1 -1
  166. package/src/browserStackSdk.js +1 -1
  167. package/src/helpers/BrowserStackSetup.js +1 -1
  168. package/src/helpers/accessibility-automation/accessibilityRetryHelper.js +1 -1
  169. package/src/helpers/accessibility-automation/constants.js +1 -1
  170. package/src/helpers/accessibility-automation/helper.js +1 -1
  171. package/src/helpers/accessibility-automation/scripts.js +1 -1
  172. package/src/helpers/ai-sdk/aiSdkWrapper.js +1 -1
  173. package/src/helpers/ai-sdk/autoHealHelper.js +1 -1
  174. package/src/helpers/ats/constants.js +1 -1
  175. package/src/helpers/ats/helper.js +1 -1
  176. package/src/helpers/caCertHelper.js +1 -1
  177. package/src/helpers/capsMapping.js +1 -1
  178. package/src/helpers/central-scanner/constants.js +1 -1
  179. package/src/helpers/central-scanner/helpers.js +1 -1
  180. package/src/helpers/classLogger.js +1 -1
  181. package/src/helpers/driverInitErrorReporter.js +1 -1
  182. package/src/helpers/globals.js +1 -1
  183. package/src/helpers/helper.js +1 -1
  184. package/src/helpers/logger.js +1 -1
  185. package/src/helpers/metadata.js +1 -1
  186. package/src/helpers/patchHelper.js +1 -1
  187. package/src/helpers/patchHelpers.js +1 -1
  188. package/src/helpers/percy/Percy.js +1 -1
  189. package/src/helpers/percy/PercyBinary.js +1 -1
  190. package/src/helpers/percy/PercyCaptureMap.js +1 -1
  191. package/src/helpers/percy/PercyCaptureModes.js +1 -1
  192. package/src/helpers/percy/PercySDK.js +1 -1
  193. package/src/helpers/percy/index.js +1 -1
  194. package/src/helpers/percy/utils.js +1 -1
  195. package/src/helpers/performance/constants.js +1 -1
  196. package/src/helpers/performance/performance-tester.js +1 -1
  197. package/src/helpers/playwright-helper.js +1 -1
  198. package/src/helpers/processHelper.js +1 -1
  199. package/src/helpers/puppeteer-helper.js +1 -1
  200. package/src/helpers/request-spy.js +1 -1
  201. package/src/helpers/setKeepAlive.js +1 -1
  202. package/src/helpers/stackFrameUtils.js +1 -1
  203. package/src/helpers/test-observability/constants.js +1 -1
  204. package/src/helpers/test-observability/error-handler.js +1 -1
  205. package/src/helpers/test-observability/requestQueueHandler.js +1 -1
  206. package/src/helpers/test-observability/sessionHandler.js +1 -1
  207. package/src/helpers/test-observability/utils.js +1 -1
  208. package/src/helpers/test-orchestration/constants.js +1 -1
  209. package/src/helpers/test-orchestration/failfastManager.js +1 -1
  210. package/src/helpers/test-orchestration/fileHelper.js +1 -1
  211. package/src/helpers/test-orchestration/orchestrationUtils.js +1 -1
  212. package/src/helpers/test-orchestration/requestUtils.js +1 -1
  213. package/src/helpers/test-orchestration/testOrchestrationHandler.js +1 -1
  214. package/src/helpers/test-orchestration/testOrderingServerHandler.js +1 -1
  215. package/src/helpers/testhub/constants.js +1 -1
  216. package/src/helpers/testhub/testhubHandler.js +1 -1
  217. package/src/helpers/testhub/utils.js +1 -1
  218. package/src/helpers/timeoutPromise.js +1 -1
  219. package/src/helpers/utilities.js +1 -1
  220. package/src/helpers/w3cMapping.js +1 -1
  221. package/src/hubAllocationMethods.js +1 -1
  222. package/src/index.js +1 -1
@@ -1 +1 @@
1
- const a31_0x32f0aa=a31_0x28b4;function a31_0x28b4(_0xaca343,_0x503e09){const _0x540f29=a31_0x540f();return a31_0x28b4=function(_0x28b431,_0x288bcf){_0x28b431=_0x28b431-0xf2;let _0xb0cbba=_0x540f29[_0x28b431];return _0xb0cbba;},a31_0x28b4(_0xaca343,_0x503e09);}(function(_0x5d4c36,_0xbcb0fe){const _0x28a3d1=a31_0x28b4,_0x15dde8=_0x5d4c36();while(!![]){try{const _0x343382=-parseInt(_0x28a3d1(0x11e))/0x1*(parseInt(_0x28a3d1(0x110))/0x2)+parseInt(_0x28a3d1(0x114))/0x3+-parseInt(_0x28a3d1(0x112))/0x4*(parseInt(_0x28a3d1(0x105))/0x5)+-parseInt(_0x28a3d1(0xff))/0x6+-parseInt(_0x28a3d1(0x121))/0x7+parseInt(_0x28a3d1(0x117))/0x8+parseInt(_0x28a3d1(0xf6))/0x9*(parseInt(_0x28a3d1(0x10f))/0xa);if(_0x343382===_0xbcb0fe)break;else _0x15dde8['push'](_0x15dde8['shift']());}catch(_0x26428f){_0x15dde8['push'](_0x15dde8['shift']());}}}(a31_0x540f,0x31bde));function a31_0x540f(){const _0x3d3c33=['768ZBZcbe','_bsConfig','458924xbzevx','__platformCaps','1045560tzhUur','testsPassed','setConfig','1791880rwNavf','../../helpers/performance/constants','configuration','14|2|21|5|11|19|7|4|0|18|16|3|15|9|6|8|10|23|17|20|12|22|1|13','split','formatter','BInwn','208EcRpki','_argv','testsSkipped','2007313YTGRJX','resolvePaths','totalTests','testSuites','../../helpers/test-observability/requestQueueHandler','testsErrorMessage','_configuration','../../helpers/ai-sdk/autoHealHelper','368118jorBBI','testsUnknown','platform','../utils/constants','EVENTS','setupCucumber','_testObservability','../utils/clientTroubleshootingService','../../helpers/helper','796878dChaSU','testsUndefined','includes','path','setFramework','../../helpers/performance/performance-tester','5jXovsa','../../helpers/test-observability/utils','_formatter','__platform__','npIAi','testsFailed','platformCaps','testsAmbiguous','capability','../../helpers/accessibility-automation/helper','60XPNNxz'];a31_0x540f=function(){return _0x3d3c33;};return a31_0x540f();}const path=require(a31_0x32f0aa(0x102)),{requireModule,modifyCommand,getPlatformName,cleanupDrivers,isBrowserstackInfra}=require(a31_0x32f0aa(0xfe)),constants=require(a31_0x32f0aa(0xf9)),{isAccessibilityAutomationSession}=require(a31_0x32f0aa(0x10e)),RequestQueueHandler=require(a31_0x32f0aa(0xf2)),{isTestObservabilitySession}=require(a31_0x32f0aa(0x106)),helper=require(a31_0x32f0aa(0xfe)),PerformanceTester=require(a31_0x32f0aa(0x104)),PerformanceEvents=require(a31_0x32f0aa(0x118))[a31_0x32f0aa(0xfa)],{commandRepository}=require(a31_0x32f0aa(0xf5)),BrowserstackCLI=require('../v2/browserstackCLI'),ClientTroubleShootingService=require(a31_0x32f0aa(0xfd));class Launcher{constructor(_0xfdf64b,_0x47cb9b,_0x35f1cb,_0x987ca4=[]){const _0x3c0f0c=a31_0x32f0aa,_0x3e91bb={'BInwn':_0x3c0f0c(0x11a),'npIAi':function(_0x1390d7){return _0x1390d7();}},_0x4b3eb0=_0x3e91bb[_0x3c0f0c(0x11d)][_0x3c0f0c(0x11b)]('|');let _0x1b84a2=0x0;while(!![]){switch(_0x4b3eb0[_0x1b84a2++]){case'0':this[_0x3c0f0c(0x111)]=_0x35f1cb;continue;case'1':global[_0x3c0f0c(0xf3)]={};continue;case'2':this[_0x3c0f0c(0xf4)]=_0x47cb9b[_0x3c0f0c(0x119)]||{};continue;case'3':global[_0x3c0f0c(0x113)]=this[_0x3c0f0c(0xf4)][_0x3c0f0c(0x10b)]||{};continue;case'4':this[_0x3c0f0c(0x11f)]=_0x987ca4;continue;case'5':this['_mochaOpts']=_0x47cb9b['mochaOpts'];continue;case'6':global[_0x3c0f0c(0x115)]=0x0;continue;case'7':global[_0x3c0f0c(0x108)]=this[_0x3c0f0c(0xf4)][_0x3c0f0c(0xf8)];continue;case'8':global[_0x3c0f0c(0x10a)]=0x0;continue;case'9':global[_0x3c0f0c(0x123)]=0x0;continue;case'10':global['testsPending']=0x0;continue;case'11':this[_0x3c0f0c(0x107)]=_0x47cb9b[_0x3c0f0c(0x11c)];continue;case'12':global[_0x3c0f0c(0xf7)]=0x0;continue;case'13':!constants['AI_ENABLED_FRAMEWORK'][_0x3c0f0c(0x101)](_0xfdf64b)&&(commandRepository[_0x3c0f0c(0x116)](_0x35f1cb),commandRepository[_0x3c0f0c(0x103)](_0xfdf64b));continue;case'14':this['_framework']=_0xfdf64b;continue;case'15':global[_0x3c0f0c(0x124)]=0x0;continue;case'16':this['_accessibilityAutomation']=_0x3e91bb['npIAi'](isAccessibilityAutomationSession);continue;case'17':global['testSuitesFailed']=0x0;continue;case'18':this[_0x3c0f0c(0xfc)]=_0x3e91bb[_0x3c0f0c(0x109)](isTestObservabilitySession);continue;case'19':this['_capability']=this[_0x3c0f0c(0xf4)][_0x3c0f0c(0x10d)];continue;case'20':global[_0x3c0f0c(0x100)]=0x0;continue;case'21':this[_0x3c0f0c(0xf4)]['framework']=_0xfdf64b;continue;case'22':global[_0x3c0f0c(0x10c)]=0x0;continue;case'23':global[_0x3c0f0c(0x120)]=0x0;continue;}break;}}[a31_0x32f0aa(0xfb)](_0x564511,_0x3a0bd8,_0x45a2ab){const _0x44fbcf=a31_0x32f0aa,_0xdcbd2d=_0x564511[_0x44fbcf(0x122)];_0x564511.resolvePaths=async function(){const pathResults=await _0xdcbd2d.apply(this,arguments);if(!pathResults.requirePaths){pathResults.requirePaths=[];}pathResults.requirePaths=[path.join(__dirname,'../cucumber-js/test.setup.js')].concat(pathResults.requirePaths,path.join(__dirname,_0x45a2ab));return pathResults;};const relativeFormatterPath=path.relative(process.cwd(),path.join(__dirname,'../cucumber-js/formatter/custom_formatter.js'));const normalizedPath=relativeFormatterPath.startsWith('.')?relativeFormatterPath:`./${relativeFormatterPath}`;_0x3a0bd8.push('--format'),_0x3a0bd8.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;
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 'use strict';function a32_0x4e24(){const _0x279823=['../../helpers/helper','911664WDTcTg','edSHg','exports','IduZp','readConfig','33704GrZzCE','108MBSqwf','accessKey','kTtBM','hjrPA','SIGHUP','stringify','vwsqM','241094XBzgQt','../../helpers/logger','18UasGse','817743WqowiF','UjRIp','forEach','BROWSERSTACK_ACCESSKEY','CLI\x20binary\x20found,\x20Checking\x20for\x20CLI\x20updates','2139700bRsyCv','load','Error\x20Details:\x20','stack','Failed\x20initiating\x20load\x20test:\x20','CLI\x20binary\x20not\x20found,\x20downloading\x20latest\x20version','Received\x20','getCliDir','Failed\x20to\x20determine\x20CLI\x20directory','\x20exited\x20with\x20code\x20','exit','VrhmX','Spawning:\x20','Failed\x20to\x20download\x20or\x20locate\x20CLI\x20binary','getExistingCliPath','winstonLogger','slice','kill','env','BROWSERSTACK_USER','912405GAKOdl','error','SIGQUIT','checkAndUpdateCli','debug','inherit','../v2/cliUtils','xKSzc','26074yLLHjZ','auWLG','path','19vVcDBI','SIGINT','eOFBY','Authentication\x20incomplete.\x20Please\x20add\x20your\x20userName\x20and\x20accessKey\x20to\x20either\x20the\x20browserstack.yml\x20file\x20or\x20as\x20environment\x20variables,\x20then\x20try\x20running\x20the\x20command\x20again.','Oblzu','tdHUv','Error\x20details:\x20','SIGTERM','child_process','message','xWRQg','BROWSERSTACK_ACCESS_KEY','./loadUtils','Error\x20loading\x20configuration:\x20','close','MOjjt','PmCpB','userName','argv','Configuration\x20path:\x20'];a32_0x4e24=function(){return _0x279823;};return a32_0x4e24();}const a32_0x1f35d2=a32_0x4dd8;(function(_0x334b5d,_0x4950f8){const _0x5efcf0=a32_0x4dd8,_0x4d4ccd=_0x334b5d();while(!![]){try{const _0x2797e0=parseInt(_0x5efcf0(0x1a6))/0x1*(-parseInt(_0x5efcf0(0x1a3))/0x2)+parseInt(_0x5efcf0(0x182))/0x3+-parseInt(_0x5efcf0(0x172))/0x4+parseInt(_0x5efcf0(0x19b))/0x5+-parseInt(_0x5efcf0(0x181))/0x6*(parseInt(_0x5efcf0(0x17f))/0x7)+-parseInt(_0x5efcf0(0x177))/0x8*(-parseInt(_0x5efcf0(0x178))/0x9)+parseInt(_0x5efcf0(0x187))/0xa;if(_0x2797e0===_0x4950f8)break;else _0x4d4ccd['push'](_0x4d4ccd['shift']());}catch(_0x46e077){_0x4d4ccd['push'](_0x4d4ccd['shift']());}}}(a32_0x4e24,0x22563));const {spawn}=require(a32_0x1f35d2(0x1ae)),path=require(a32_0x1f35d2(0x1a5)),helper=require(a32_0x1f35d2(0x171)),CLIUtils=require(a32_0x1f35d2(0x1a1)),{getLoadConfigPath,sleep}=require(a32_0x1f35d2(0x169)),logger=require(a32_0x1f35d2(0x180))[a32_0x1f35d2(0x196)];function a32_0x4dd8(_0x3be39e,_0x1f28d0){const _0x4e2484=a32_0x4e24();return a32_0x4dd8=function(_0x4dd87f,_0x2715f7){_0x4dd87f=_0x4dd87f-0x167;let _0x4bfc96=_0x4e2484[_0x4dd87f];return _0x4bfc96;},a32_0x4dd8(_0x3be39e,_0x1f28d0);}async function executeLoadTest(_0x542d29){const _0x157fa7=a32_0x1f35d2,_0x485c2c={'WKWwQ':function(_0xd571f2,_0xf114e7){return _0xd571f2(_0xf114e7);},'vwsqM':_0x157fa7(0x16b),'ZNMOk':'Waiting\x20for\x20child\x20process\x20to\x20exit...','VrhmX':'Loading\x20configuration\x20using\x20environment\x20variables\x20if\x20available.','tfYQb':function(_0x4d8d86,_0x1d9507){return _0x4d8d86(_0x1d9507);},'kLbtB':function(_0x1d5105){return _0x1d5105();},'tdHUv':_0x157fa7(0x1a9),'IduZp':function(_0x1a59f1){return _0x1a59f1();},'MOjjt':_0x157fa7(0x18f),'sUuGM':function(_0x4674a9){return _0x4674a9();},'xWRQg':_0x157fa7(0x18c),'hjrPA':_0x157fa7(0x186),'auWLG':function(_0x1437b0){return _0x1437b0();},'Lmiyy':_0x157fa7(0x194),'kTtBM':function(_0x4889be,_0x4c3463,_0x5632be,_0x109001){return _0x4889be(_0x4c3463,_0x5632be,_0x109001);},'sotAS':_0x157fa7(0x188),'Oblzu':_0x157fa7(0x1a0),'PmCpB':_0x157fa7(0x1a7),'edSHg':_0x157fa7(0x1ad),'xKSzc':_0x157fa7(0x19d),'lIFqr':_0x157fa7(0x17c),'eOFBY':function(_0x465a37){return _0x465a37();}};try{const _0x5bb1cb=process[_0x157fa7(0x16f)][_0x157fa7(0x197)](0x2),_0x54e29b=_0x5bb1cb[_0x157fa7(0x197)](0x1);logger['debug']('Executing\x20load\x20test\x20with\x20arguments:\x20'+_0x54e29b);let _0x340428={};try{logger[_0x157fa7(0x19f)](_0x485c2c[_0x157fa7(0x192)]);const _0x541f8d={};_0x541f8d[_0x157fa7(0x16e)]=process['env']['BROWSERSTACK_USERNAME']||process['env'][_0x157fa7(0x19a)],_0x541f8d[_0x157fa7(0x179)]=process['env'][_0x157fa7(0x168)]||process[_0x157fa7(0x199)][_0x157fa7(0x185)],_0x340428=_0x541f8d;if(!_0x340428[_0x157fa7(0x16e)]||!_0x340428[_0x157fa7(0x179)]){const _0x455244=_0x485c2c['tfYQb'](getLoadConfigPath,_0x542d29['argv']);logger['debug'](_0x157fa7(0x170)+_0x455244),_0x455244&&(_0x340428=helper[_0x157fa7(0x176)](_0x455244));}}catch(_0x21a458){logger[_0x157fa7(0x19c)](_0x157fa7(0x16a)+_0x21a458[_0x157fa7(0x1af)]),logger[_0x157fa7(0x19f)](_0x157fa7(0x1ac)+(_0x21a458[_0x157fa7(0x18a)]||JSON[_0x157fa7(0x17d)](_0x21a458))),await _0x485c2c['kLbtB'](sleep),process[_0x157fa7(0x191)](0x1);}(!_0x340428[_0x157fa7(0x16e)]||!_0x340428[_0x157fa7(0x179)])&&(logger[_0x157fa7(0x19c)](_0x485c2c[_0x157fa7(0x1ab)]),await _0x485c2c[_0x157fa7(0x175)](sleep),process[_0x157fa7(0x191)](0x1));const _0x2b20f6=CLIUtils[_0x157fa7(0x18e)]();!_0x2b20f6&&(logger[_0x157fa7(0x19c)](_0x485c2c[_0x157fa7(0x16c)]),await _0x485c2c['sUuGM'](sleep),process[_0x157fa7(0x191)](0x1));let _0x3eaa58=CLIUtils[_0x157fa7(0x195)](_0x2b20f6);try{!_0x3eaa58?(logger[_0x157fa7(0x19f)](_0x485c2c[_0x157fa7(0x167)]),_0x3eaa58=await CLIUtils[_0x157fa7(0x19e)]('',_0x2b20f6,_0x340428)):(logger['debug'](_0x485c2c[_0x157fa7(0x17b)]),_0x3eaa58=await CLIUtils[_0x157fa7(0x19e)](_0x3eaa58,_0x2b20f6,_0x340428));}catch(_0x5e15b5){logger[_0x157fa7(0x19c)](_0x485c2c[_0x157fa7(0x1ab)]),logger[_0x157fa7(0x19f)](_0x157fa7(0x189)+(_0x5e15b5[_0x157fa7(0x18a)]||JSON['stringify'](_0x5e15b5))),await _0x485c2c[_0x157fa7(0x1a4)](sleep),process[_0x157fa7(0x191)](0x1);}!_0x3eaa58&&(logger[_0x157fa7(0x19c)](_0x485c2c[_0x157fa7(0x1ab)]),logger['debug'](_0x485c2c['Lmiyy']),await _0x485c2c['auWLG'](sleep),process[_0x157fa7(0x191)](0x1));logger[_0x157fa7(0x19f)](_0x157fa7(0x193)+_0x3eaa58+'\x20load\x20'+_0x54e29b['join']('\x20'));const _0x54e3f3=_0x485c2c[_0x157fa7(0x17a)](spawn,_0x3eaa58,[_0x485c2c['sotAS'],..._0x54e29b],{'stdio':_0x485c2c[_0x157fa7(0x1aa)]});let _0x3723b3=![];const _0x4d4acc=new Promise(_0x2f7e78=>{const _0x148bf1=_0x157fa7;_0x54e3f3['on'](_0x485c2c[_0x148bf1(0x17e)],_0x3a78df=>{const _0x3a2fce=_0x148bf1;logger['debug'](_0x3eaa58+_0x3a2fce(0x190)+_0x3a78df),_0x485c2c['WKWwQ'](_0x2f7e78,_0x3a78df);});});[_0x485c2c[_0x157fa7(0x16d)],_0x485c2c[_0x157fa7(0x173)],_0x485c2c[_0x157fa7(0x1a2)],_0x485c2c['lIFqr']][_0x157fa7(0x184)](_0x49cde1=>{const _0x323d83={};_0x323d83['UjRIp']=_0x485c2c['ZNMOk'];const _0x3dd42c=_0x323d83;process['on'](_0x49cde1,()=>{const _0x3ff8f6=a32_0x4dd8;if(_0x3723b3)return;_0x3723b3=!![],logger[_0x3ff8f6(0x19f)](_0x3ff8f6(0x18d)+_0x49cde1+',\x20forwarding\x20to\x20child\x20process...'),_0x54e3f3&&!_0x54e3f3['killed']&&(_0x54e3f3[_0x3ff8f6(0x198)](_0x49cde1),logger[_0x3ff8f6(0x19f)](_0x3dd42c[_0x3ff8f6(0x183)]));});});const _0x14d734=await _0x4d4acc;await _0x485c2c[_0x157fa7(0x175)](sleep),process[_0x157fa7(0x191)](_0x14d734);}catch(_0xbb6a38){logger[_0x157fa7(0x19c)](_0x157fa7(0x18b)+_0xbb6a38['message']),logger[_0x157fa7(0x19f)](_0x157fa7(0x1ac)+(_0xbb6a38['stack']||JSON[_0x157fa7(0x17d)](_0xbb6a38))),await _0x485c2c[_0x157fa7(0x1a8)](sleep),process['exit'](0x1);}}module[a32_0x1f35d2(0x174)]=executeLoadTest;
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
- logger.error(`Error loading configuration: ${error.message}`);
37
- logger.debug(`Error details: ${error.stack || JSON.stringify(error)}`);
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
- 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.');
71
- logger.debug(`Error Details: ${error.stack || JSON.stringify(error)}`);
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('Authentication incomplete. Please add your userName and accessKey to either the browserstack.yml file or as environment variables, then try running the command again.');
78
- logger.debug('Failed to download or locate CLI binary');
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
- childProc.on('close', (code) => {
95
- logger.debug(`${binaryPath} exited with code ${code}`);
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
- logger.error(`Failed initiating load test: ${error.message}`);
127
- logger.debug(`Error details: ${error.stack || JSON.stringify(error)}`);
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
  }