5
5
const util = require ( 'util' ) ;
6
6
7
7
let eventsQueue = [ ] ;
8
+ let testRunStarted = false ;
8
9
9
10
const browserStackLog = ( message ) => {
10
11
if ( ! Cypress . env ( 'BROWSERSTACK_LOGS' ) ) return ;
@@ -48,7 +49,8 @@ Cypress.on('command:start', (command) => {
48
49
args : command . attributes . args
49
50
} ,
50
51
state : 'pending' ,
51
- started_at : new Date ( ) . toISOString ( )
52
+ started_at : new Date ( ) . toISOString ( ) ,
53
+ location : testRunStarted ? 'test' : 'hook'
52
54
}
53
55
} ,
54
56
options : { log : false }
@@ -82,7 +84,8 @@ Cypress.on('command:retry', (command) => {
82
84
error : {
83
85
message : command && command . error ? command . error . message : null ,
84
86
isDefaultAssertionErr : command && command . error ? command . error . isDefaultAssertionErr : null
85
- }
87
+ } ,
88
+ location : testRunStarted ? 'test' : 'hook'
86
89
}
87
90
} ,
88
91
options : { log : false }
@@ -105,7 +108,8 @@ Cypress.on('command:end', (command) => {
105
108
'args' : command . attributes . args
106
109
} ,
107
110
'state' : command . state ,
108
- finished_at : new Date ( ) . toISOString ( )
111
+ finished_at : new Date ( ) . toISOString ( ) ,
112
+ location : testRunStarted ? 'test' : 'hook'
109
113
}
110
114
} ,
111
115
options : { log : false }
@@ -213,6 +217,7 @@ beforeEach(() => {
213
217
} ) ;
214
218
}
215
219
eventsQueue = [ ] ;
220
+ testRunStarted = true ;
216
221
} ) ;
217
222
218
223
afterEach ( function ( ) {
@@ -224,4 +229,5 @@ afterEach(function() {
224
229
}
225
230
226
231
eventsQueue = [ ] ;
232
+ testRunStarted = false ;
227
233
} ) ;
0 commit comments