55const util = require ( 'util' ) ;
66
77let eventsQueue = [ ] ;
8+ let testRunStarted = false ;
89
910const browserStackLog = ( message ) => {
1011 if ( ! Cypress . env ( 'BROWSERSTACK_LOGS' ) ) return ;
@@ -48,7 +49,8 @@ Cypress.on('command:start', (command) => {
4849 args : command . attributes . args
4950 } ,
5051 state : 'pending' ,
51- started_at : new Date ( ) . toISOString ( )
52+ started_at : new Date ( ) . toISOString ( ) ,
53+ location : testRunStarted ? 'test' : 'hook'
5254 }
5355 } ,
5456 options : { log : false }
@@ -82,7 +84,8 @@ Cypress.on('command:retry', (command) => {
8284 error : {
8385 message : command && command . error ? command . error . message : null ,
8486 isDefaultAssertionErr : command && command . error ? command . error . isDefaultAssertionErr : null
85- }
87+ } ,
88+ location : testRunStarted ? 'test' : 'hook'
8689 }
8790 } ,
8891 options : { log : false }
@@ -105,7 +108,8 @@ Cypress.on('command:end', (command) => {
105108 'args' : command . attributes . args
106109 } ,
107110 'state' : command . state ,
108- finished_at : new Date ( ) . toISOString ( )
111+ finished_at : new Date ( ) . toISOString ( ) ,
112+ location : testRunStarted ? 'test' : 'hook'
109113 }
110114 } ,
111115 options : { log : false }
@@ -213,6 +217,7 @@ beforeEach(() => {
213217 } ) ;
214218 }
215219 eventsQueue = [ ] ;
220+ testRunStarted = true ;
216221} ) ;
217222
218223afterEach ( function ( ) {
@@ -224,4 +229,5 @@ afterEach(function() {
224229 }
225230
226231 eventsQueue = [ ] ;
232+ testRunStarted = false ;
227233} ) ;
0 commit comments