@@ -4,7 +4,8 @@ const { readCypressConfigFile } = require('./readCypressConfigUtil');
44
55const logger = require ( "./logger" ) . winstonLogger ,
66 Constants = require ( "./constants" ) ,
7- Utils = require ( "./utils" ) ;
7+ Utils = require ( "./utils" ) ,
8+ testhubUtils = require ( "../testhub/utils" ) ;
89
910const caps = ( bsConfig , zip ) => {
1011 return new Promise ( function ( resolve , reject ) {
@@ -131,6 +132,18 @@ const caps = (bsConfig, zip) => {
131132 obj . run_settings = JSON . stringify ( bsConfig . run_settings ) ;
132133 }
133134
135+ // The only route by which a cypress session can name its TestHub build: every session
136+ // this build spawns inherits these caps. Written unconditionally so an empty uuid records
137+ // that build start ran and had nothing to name, which an absent key cannot express.
138+ // "null" is the sentinel a failed build start leaves behind, not a uuid.
139+ const testhubBuildUuid = process . env . BROWSERSTACK_TESTHUB_UUID ;
140+ obj . testhubBuildUuid = Utils . isUndefined ( testhubBuildUuid ) || testhubBuildUuid === "null"
141+ ? ""
142+ : testhubBuildUuid ;
143+ obj . buildProductMap = testhubUtils . getProductMap ( bsConfig ) ;
144+
145+ logger . debug ( `TestHub build uuid stamped on caps: ${ obj . testhubBuildUuid || "<empty>" } ` ) ;
146+
134147 obj . cypress_cli_user_agent = Utils . getUserAgent ( ) ;
135148
136149 logger . info ( `Cypress CLI User Agent: ${ obj . cypress_cli_user_agent } ` ) ;
0 commit comments