@@ -119,50 +119,24 @@ describe('Reporter', () => {
119
119
expect ( spyStartSuites ) . toHaveBeenCalledTimes ( 0 ) ;
120
120
} ) ;
121
121
122
- test ( 'should start and finish retries in case of any invocations of skipped tests' , ( ) => {
122
+ test ( 'should start and finish skipped tests' , ( ) => {
123
123
const spyStartStep = jest . spyOn ( reporter , '_startStep' ) ;
124
124
const spyFinishStep = jest . spyOn ( reporter , '_finishStep' ) ;
125
125
126
- reporter . onTestResult ( testObj , testResultWithSkipped ) ;
127
- const skippedTestResultWithStartedAt = { startedAt : currentDateInMs , ...skippedTestResult } ;
128
-
129
- expect ( spyStartStep ) . toHaveBeenNthCalledWith (
130
- 1 ,
131
- skippedTestResultWithStartedAt ,
132
- testObj . path ,
133
- false ,
134
- ) ;
135
- expect ( spyStartStep ) . toHaveBeenNthCalledWith (
136
- 2 ,
137
- skippedTestResultWithStartedAt ,
138
- testObj . path ,
139
- true ,
140
- ) ;
141
- expect ( spyFinishStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt ) ;
142
- expect ( spyStartStep ) . toHaveBeenCalledTimes ( 2 ) ;
143
- expect ( spyFinishStep ) . toHaveBeenCalledTimes ( 2 ) ;
144
- } ) ;
145
-
146
- test ( 'should start and finish just skipped test in case of no or empty invocations' , ( ) => {
147
- const spyStartStep = jest . spyOn ( reporter , '_startStep' ) ;
148
- const spyFinishStep = jest . spyOn ( reporter , '_finishStep' ) ;
149
-
150
- const { invocations, ...skippedTestResultWithoutInvocations } = skippedTestResult ;
151
-
152
126
const testResult = {
153
- testResults : [ skippedTestResultWithoutInvocations ] ,
127
+ testResults : [ skippedTestResult ] ,
154
128
testFilePath,
155
129
} ;
156
130
157
131
reporter . onTestResult ( testObj , testResult ) ;
158
132
159
133
const skippedTestResultWithStartedAt = {
160
134
startedAt : currentDateInMs ,
161
- ...skippedTestResultWithoutInvocations ,
135
+ ...skippedTestResult ,
162
136
} ;
163
137
164
138
expect ( spyStartStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt , testObj . path ) ;
165
- expect ( spyFinishStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt ) ;
139
+ expect ( spyFinishStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt , testObj . path ) ;
166
140
expect ( spyStartStep ) . toHaveBeenCalledTimes ( 1 ) ;
167
141
expect ( spyFinishStep ) . toHaveBeenCalledTimes ( 1 ) ;
168
142
} ) ;
@@ -312,7 +286,7 @@ describe('Reporter', () => {
312
286
startTime : currentDateInMs ,
313
287
retry : false ,
314
288
} ;
315
- const expectedTempStepIds = new Map ( [ [ 'Suite/Step' , 'startTestItem' ] ] ) ;
289
+ const expectedTempStepIds = new Map ( [ [ 'example.js/ Suite/Step' , [ 'startTestItem' ] ] ] ) ;
316
290
317
291
expect ( reporter . client . startTestItem ) . toHaveBeenCalledWith (
318
292
expectedStartStepItemParameter ,
@@ -343,19 +317,24 @@ describe('Reporter', () => {
343
317
} ) ;
344
318
345
319
describe ( '_finishStep' , ( ) => {
320
+ beforeEach ( ( ) => {
321
+ reporter . tempStepIds . set ( 'example.js/suite/fake test' , [ 'tempStepId' ] ) ;
322
+ } ) ;
323
+
346
324
test ( '_finishPassedTest should be called if step status is passed' , ( ) => {
347
325
const spyFinishPassedTest = jest . spyOn ( reporter , '_finishPassedStep' ) ;
348
326
const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
349
327
const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
350
328
351
- reporter . tempStepIds . set ( '/fake test' , 'tempStepId' ) ;
352
-
353
- reporter . _finishStep ( {
354
- status : TEST_ITEM_STATUSES . PASSED ,
355
- failureMessages : [ ] ,
356
- ancestorTitles : [ ] ,
357
- title : 'fake test' ,
358
- } ) ;
329
+ reporter . _finishStep (
330
+ {
331
+ status : TEST_ITEM_STATUSES . PASSED ,
332
+ failureMessages : [ ] ,
333
+ ancestorTitles : [ 'suite' ] ,
334
+ title : 'fake test' ,
335
+ } ,
336
+ testFilePath ,
337
+ ) ;
359
338
360
339
expect ( spyFinishPassedTest ) . toHaveBeenCalled ( ) ;
361
340
expect ( spyFinishFailedTest ) . not . toHaveBeenCalled ( ) ;
@@ -367,16 +346,14 @@ describe('Reporter', () => {
367
346
const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
368
347
const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
369
348
370
- reporter . tempStepIds . set ( '/fake test' , 'tempStepId' ) ;
371
-
372
349
reporter . _finishStep (
373
350
{
374
351
status : TEST_ITEM_STATUSES . FAILED ,
375
352
failureMessages : [ 'error message' ] ,
376
- ancestorTitles : [ ] ,
353
+ ancestorTitles : [ 'suite' ] ,
377
354
title : 'fake test' ,
378
355
} ,
379
- false ,
356
+ testFilePath ,
380
357
) ;
381
358
382
359
expect ( spyFinishFailedTest ) . toHaveBeenCalledWith ( 'tempStepId' , 'error message' ) ;
@@ -389,14 +366,15 @@ describe('Reporter', () => {
389
366
const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
390
367
const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
391
368
392
- reporter . tempStepIds . set ( '/fake test' , 'tempStepId' ) ;
393
-
394
- reporter . _finishStep ( {
395
- status : TEST_ITEM_STATUSES . SKIPPED ,
396
- failureMessages : [ ] ,
397
- ancestorTitles : [ ] ,
398
- title : 'fake test' ,
399
- } ) ;
369
+ reporter . _finishStep (
370
+ {
371
+ status : TEST_ITEM_STATUSES . SKIPPED ,
372
+ failureMessages : [ ] ,
373
+ ancestorTitles : [ 'suite' ] ,
374
+ title : 'fake test' ,
375
+ } ,
376
+ testFilePath ,
377
+ ) ;
400
378
401
379
expect ( spyFinishSkippedTest ) . toHaveBeenCalled ( ) ;
402
380
expect ( spyFinishPassedTest ) . not . toHaveBeenCalled ( ) ;
0 commit comments