@@ -116,7 +116,7 @@ exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
116
116
if ( exitCode ) process . exit ( exitCode ) ;
117
117
}
118
118
119
- const nodeRequest = ( type , url , data , config ) => {
119
+ exports . nodeRequest = ( type , url , data , config ) => {
120
120
const requestQueueHandler = require ( './requestQueueHandler' ) ;
121
121
return new Promise ( async ( resolve , reject ) => {
122
122
const options = {
@@ -269,7 +269,7 @@ exports.getPackageVersion = (package_, bsConfig = null) => {
269
269
return packageVersion ;
270
270
}
271
271
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 ) => {
273
273
process . env . BS_TESTOPS_JWT = BS_TESTOPS_JWT ;
274
274
process . env . BS_TESTOPS_BUILD_HASHED_ID = BS_TESTOPS_BUILD_HASHED_ID ;
275
275
process . env . BS_TESTOPS_ALLOW_SCREENSHOTS = BS_TESTOPS_ALLOW_SCREENSHOTS ;
@@ -414,10 +414,10 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
414
414
}
415
415
} ;
416
416
417
- const response = await nodeRequest ( 'POST' , 'api/v1/builds' , data , config ) ;
417
+ const response = await exports . nodeRequest ( 'POST' , 'api/v1/builds' , data , config ) ;
418
418
exports . debug ( 'Build creation successfull!' ) ;
419
419
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 ) ;
421
421
if ( this . isBrowserstackInfra ( ) && ( user_config . run_settings . auto_import_dev_dependencies != true ) ) helper . setBrowserstackCypressCliDependency ( user_config ) ;
422
422
} catch ( error ) {
423
423
if ( ! error . errorType ) {
@@ -444,7 +444,7 @@ exports.launchTestSession = async (user_config, bsConfigPath) => {
444
444
}
445
445
446
446
process . env . BS_TESTOPS_BUILD_COMPLETED = false ;
447
- setEnvironmentVariablesForRemoteReporter ( null , null , null ) ;
447
+ exports . setEnvironmentVariablesForRemoteReporter ( null , null , null ) ;
448
448
}
449
449
}
450
450
}
@@ -503,7 +503,7 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
503
503
try {
504
504
const eventsUuids = data . map ( eventData => `${ eventData . event_type } :${ eventData . test_run ? eventData . test_run . uuid : ( eventData . hook_run ? eventData . hook_run . uuid : null ) } ` ) . join ( ', ' ) ;
505
505
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 ) ;
507
507
exports . debugOnConsole ( `[Request Batch Response] for events:uuids ${ eventsUuids } ` ) ;
508
508
if ( response . data . error ) {
509
509
throw ( { message : response . data . error } ) ;
@@ -570,7 +570,7 @@ exports.uploadEventData = async (eventData, run=0) => {
570
570
try {
571
571
const eventsUuids = data . map ( eventData => `${ eventData . event_type } :${ eventData . test_run ? eventData . test_run . uuid : ( eventData . hook_run ? eventData . hook_run . uuid : null ) } ` ) . join ( ', ' ) ;
572
572
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 ) ;
574
574
exports . debugOnConsole ( `[Request Repsonse] ${ util . format ( response . data ) } for events:uuids ${ eventsUuids } ` )
575
575
if ( response . data . error ) {
576
576
throw ( { message : response . data . error } ) ;
@@ -681,7 +681,7 @@ exports.stopBuildUpstream = async () => {
681
681
} ;
682
682
683
683
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 ) ;
685
685
if ( response . data && response . data . error ) {
686
686
throw ( { message : response . data . error } ) ;
687
687
} else {
0 commit comments