@@ -116,7 +116,7 @@ exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
116116 if ( exitCode ) process . exit ( exitCode ) ;
117117}
118118
119- const nodeRequest = ( type , url , data , config ) => {
119+ exports . nodeRequest = ( type , url , data , config ) => {
120120 const requestQueueHandler = require ( './requestQueueHandler' ) ;
121121 return new Promise ( async ( resolve , reject ) => {
122122 const options = {
@@ -269,7 +269,7 @@ exports.getPackageVersion = (package_, bsConfig = null) => {
269269 return packageVersion ;
270270}
271271
272- const setEnvironmentVariablesForRemoteReporter = ( BS_TESTOPS_JWT , BS_TESTOPS_BUILD_HASHED_ID , BS_TESTOPS_ALLOW_SCREENSHOTS , OBSERVABILITY_LAUNCH_SDK_VERSION ) => {
272+ exports . setEnvironmentVariablesForRemoteReporter = ( BS_TESTOPS_JWT , BS_TESTOPS_BUILD_HASHED_ID , BS_TESTOPS_ALLOW_SCREENSHOTS , OBSERVABILITY_LAUNCH_SDK_VERSION ) => {
273273 process . env . BS_TESTOPS_JWT = BS_TESTOPS_JWT ;
274274 process . env . BS_TESTOPS_BUILD_HASHED_ID = BS_TESTOPS_BUILD_HASHED_ID ;
275275 process . env . BS_TESTOPS_ALLOW_SCREENSHOTS = BS_TESTOPS_ALLOW_SCREENSHOTS ;
@@ -343,7 +343,7 @@ exports.setCrashReportingConfigFromReporter = (credentialsStr, bsConfigPath, cyp
343343 }
344344}
345345
346- const setCrashReportingConfig = ( bsConfig , bsConfigPath ) => {
346+ exports . setCrashReportingConfig = ( bsConfig , bsConfigPath ) => {
347347 try {
348348 const browserstackConfigFile = utils . readBsConfigJSON ( bsConfigPath ) ;
349349 const cypressConfigFile = getCypressConfigFileContent ( bsConfig , null ) ;
@@ -414,10 +414,10 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
414414 }
415415 } ;
416416
417- const response = await nodeRequest ( 'POST' , 'api/v1/builds' , data , config ) ;
417+ const response = await exports . nodeRequest ( 'POST' , 'api/v1/builds' , data , config ) ;
418418 exports . debug ( 'Build creation successfull!' ) ;
419419 process . env . BS_TESTOPS_BUILD_COMPLETED = true ;
420- setEnvironmentVariablesForRemoteReporter ( response . data . jwt , response . data . build_hashed_id , response . data . allow_screenshots , data . observability_version . sdkVersion ) ;
420+ exports . setEnvironmentVariablesForRemoteReporter ( response . data . jwt , response . data . build_hashed_id , response . data . allow_screenshots , data . observability_version . sdkVersion ) ;
421421 if ( this . isBrowserstackInfra ( ) && ( user_config . run_settings . auto_import_dev_dependencies != true ) ) helper . setBrowserstackCypressCliDependency ( user_config ) ;
422422 } catch ( error ) {
423423 if ( ! error . errorType ) {
@@ -444,7 +444,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
444444 }
445445
446446 process . env . BS_TESTOPS_BUILD_COMPLETED = false ;
447- setEnvironmentVariablesForRemoteReporter ( null , null , null ) ;
447+ exports . setEnvironmentVariablesForRemoteReporter ( null , null , null ) ;
448448 }
449449 }
450450}
@@ -503,7 +503,7 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
503503 try {
504504 const eventsUuids = data . map ( eventData => `${ eventData . event_type } :${ eventData . test_run ? eventData . test_run . uuid : ( eventData . hook_run ? eventData . hook_run . uuid : null ) } ` ) . join ( ', ' ) ;
505505 exports . debugOnConsole ( `[Request Batch Send] for events:uuids ${ eventsUuids } ` ) ;
506- const response = await nodeRequest ( 'POST' , eventUrl , data , config ) ;
506+ const response = await exports . nodeRequest ( 'POST' , eventUrl , data , config ) ;
507507 exports . debugOnConsole ( `[Request Batch Response] for events:uuids ${ eventsUuids } ` ) ;
508508 if ( response . data . error ) {
509509 throw ( { message : response . data . error } ) ;
@@ -570,7 +570,7 @@ exports.uploadEventData = async (eventData, run=0) => {
570570 try {
571571 const eventsUuids = data . map ( eventData => `${ eventData . event_type } :${ eventData . test_run ? eventData . test_run . uuid : ( eventData . hook_run ? eventData . hook_run . uuid : null ) } ` ) . join ( ', ' ) ;
572572 exports . debugOnConsole ( `[Request Send] for events:uuids ${ eventsUuids } ` ) ;
573- const response = await nodeRequest ( 'POST' , event_api_url , data , config ) ;
573+ const response = await exports . nodeRequest ( 'POST' , event_api_url , data , config ) ;
574574 exports . debugOnConsole ( `[Request Repsonse] ${ util . format ( response . data ) } for events:uuids ${ eventsUuids } ` )
575575 if ( response . data . error ) {
576576 throw ( { message : response . data . error } ) ;
@@ -681,7 +681,7 @@ exports.stopBuildUpstream = async () => {
681681 } ;
682682
683683 try {
684- const response = await nodeRequest ( 'PUT' , `api/v1/builds/${ process . env . BS_TESTOPS_BUILD_HASHED_ID } /stop` , data , config ) ;
684+ const response = await exports . nodeRequest ( 'PUT' , `api/v1/builds/${ process . env . BS_TESTOPS_BUILD_HASHED_ID } /stop` , data , config ) ;
685685 if ( response . data && response . data . error ) {
686686 throw ( { message : response . data . error } ) ;
687687 } else {
0 commit comments