@@ -57,7 +57,8 @@ const {
57
57
getOSDetailsFromSystem,
58
58
findGitConfig,
59
59
getFileSeparatorData,
60
- setCrashReportingConfigFromReporter
60
+ setCrashReportingConfigFromReporter,
61
+ debugOnConsole
61
62
} = require ( '../helper/helper' ) ;
62
63
63
64
const { consoleHolder } = require ( '../helper/constants' ) ;
@@ -87,13 +88,15 @@ class MyReporter {
87
88
} )
88
89
89
90
. on ( EVENT_HOOK_BEGIN , async ( hook ) => {
91
+ debugOnConsole ( `[MOCHA EVENT] EVENT_HOOK_BEGIN` ) ;
90
92
if ( this . testObservability == true ) {
91
93
if ( ! hook . hookAnalyticsId ) {
92
94
hook . hookAnalyticsId = uuidv4 ( ) ;
93
95
} else if ( this . runStatusMarkedHash [ hook . hookAnalyticsId ] ) {
94
96
delete this . runStatusMarkedHash [ hook . hookAnalyticsId ] ;
95
97
hook . hookAnalyticsId = uuidv4 ( ) ;
96
98
}
99
+ debugOnConsole ( `[MOCHA EVENT] EVENT_HOOK_BEGIN for uuid: ${ hook . hookAnalyticsId } ` ) ;
97
100
hook . hook_started_at = ( new Date ( ) ) . toISOString ( ) ;
98
101
hook . started_at = ( new Date ( ) ) . toISOString ( ) ;
99
102
this . current_hook = hook ;
@@ -102,6 +105,7 @@ class MyReporter {
102
105
} )
103
106
104
107
. on ( EVENT_HOOK_END , async ( hook ) => {
108
+ debugOnConsole ( `[MOCHA EVENT] EVENT_HOOK_END` ) ;
105
109
if ( this . testObservability == true ) {
106
110
if ( ! this . runStatusMarkedHash [ hook . hookAnalyticsId ] ) {
107
111
if ( ! hook . hookAnalyticsId ) {
@@ -114,6 +118,9 @@ class MyReporter {
114
118
115
119
// Remove hooks added at hook start
116
120
delete this . hooksStarted [ hook . hookAnalyticsId ] ;
121
+
122
+ debugOnConsole ( `[MOCHA EVENT] EVENT_HOOK_END for uuid: ${ hook . hookAnalyticsId } ` ) ;
123
+
117
124
await this . sendTestRunEvent ( hook , undefined , false , "HookRunFinished" ) ;
118
125
}
119
126
}
@@ -123,7 +130,9 @@ class MyReporter {
123
130
} )
124
131
125
132
. on ( EVENT_TEST_PASS , async ( test ) => {
133
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_PASS` ) ;
126
134
if ( this . testObservability == true ) {
135
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_PASS for uuid: ${ test . testAnalyticsId } ` ) ;
127
136
if ( ! this . runStatusMarkedHash [ test . testAnalyticsId ] ) {
128
137
if ( test . testAnalyticsId ) this . runStatusMarkedHash [ test . testAnalyticsId ] = true ;
129
138
await this . sendTestRunEvent ( test ) ;
@@ -132,7 +141,9 @@ class MyReporter {
132
141
} )
133
142
134
143
. on ( EVENT_TEST_FAIL , async ( test , err ) => {
144
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_FAIL` ) ;
135
145
if ( this . testObservability == true ) {
146
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_FAIL for uuid: ${ test . testAnalyticsId } ` ) ;
136
147
if ( ( test . testAnalyticsId && ! this . runStatusMarkedHash [ test . testAnalyticsId ] ) || ( test . hookAnalyticsId && ! this . runStatusMarkedHash [ test . hookAnalyticsId ] ) ) {
137
148
if ( test . testAnalyticsId ) {
138
149
this . runStatusMarkedHash [ test . testAnalyticsId ] = true ;
@@ -146,8 +157,10 @@ class MyReporter {
146
157
} )
147
158
148
159
. on ( EVENT_TEST_PENDING , async ( test ) => {
160
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_PENDING` ) ;
149
161
if ( this . testObservability == true ) {
150
162
if ( ! test . testAnalyticsId ) test . testAnalyticsId = uuidv4 ( ) ;
163
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_PENDING for uuid: ${ test . testAnalyticsId } ` ) ;
151
164
if ( ! this . runStatusMarkedHash [ test . testAnalyticsId ] ) {
152
165
this . runStatusMarkedHash [ test . testAnalyticsId ] = true ;
153
166
await this . sendTestRunEvent ( test , undefined , false , "TestRunSkipped" ) ;
@@ -156,13 +169,17 @@ class MyReporter {
156
169
} )
157
170
158
171
. on ( EVENT_TEST_BEGIN , async ( test ) => {
172
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_BEGIN` ) ;
173
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_BEGIN for uuid: ${ test . testAnalyticsId } ` ) ;
159
174
if ( this . runStatusMarkedHash [ test . testAnalyticsId ] ) return ;
160
175
if ( this . testObservability == true ) {
161
176
await this . testStarted ( test ) ;
162
177
}
163
178
} )
164
179
165
180
. on ( EVENT_TEST_END , async ( test ) => {
181
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_END` ) ;
182
+ debugOnConsole ( `[MOCHA EVENT] EVENT_TEST_BEGIN for uuid: ${ test . testAnalyticsId } ` ) ;
166
183
if ( this . runStatusMarkedHash [ test . testAnalyticsId ] ) return ;
167
184
if ( this . testObservability == true ) {
168
185
if ( ! this . runStatusMarkedHash [ test . testAnalyticsId ] ) {
@@ -174,10 +191,12 @@ class MyReporter {
174
191
175
192
. once ( EVENT_RUN_END , async ( ) => {
176
193
try {
194
+ debugOnConsole ( `[MOCHA EVENT] EVENT_RUN_END` ) ;
177
195
if ( this . testObservability == true ) {
178
196
const hookSkippedTests = getHookSkippedTests ( this . runner . suite ) ;
179
197
for ( const test of hookSkippedTests ) {
180
198
if ( ! test . testAnalyticsId ) test . testAnalyticsId = uuidv4 ( ) ;
199
+ debugOnConsole ( `[MOCHA EVENT] EVENT_RUN_END TestRunSkipped for uuid: ${ test . testAnalyticsId } ` ) ;
181
200
await this . sendTestRunEvent ( test , undefined , false , "TestRunSkipped" ) ;
182
201
}
183
202
}
@@ -318,6 +337,8 @@ class MyReporter {
318
337
}
319
338
} ;
320
339
340
+ debugOnConsole ( `${ eventType } for uuid: ${ testData . uuid } ` ) ;
341
+
321
342
if ( eventType . match ( / T e s t R u n F i n i s h e d / ) || eventType . match ( / T e s t R u n S k i p p e d / ) ) {
322
343
testData [ 'meta' ] . steps = JSON . parse ( JSON . stringify ( this . currentTestCucumberSteps ) ) ;
323
344
this . currentTestCucumberSteps = [ ] ;
@@ -377,6 +398,7 @@ class MyReporter {
377
398
mapTestHooks ( test ) ;
378
399
}
379
400
} catch ( e ) {
401
+ debugOnConsole ( `Exception in processing hook data for event ${ eventType } with error : ${ e } ` ) ;
380
402
debug ( `Exception in processing hook data for event ${ eventType } with error : ${ e } ` , true , e ) ;
381
403
}
382
404
@@ -473,6 +495,7 @@ class MyReporter {
473
495
this . hooksStarted = { } ;
474
496
}
475
497
} catch ( error ) {
498
+ debugOnConsole ( `Exception in populating test data for event ${ eventType } with error : ${ error } ` ) ;
476
499
debug ( `Exception in populating test data for event ${ eventType } with error : ${ error } ` , true , error ) ;
477
500
}
478
501
}
0 commit comments