@@ -119,50 +119,24 @@ describe('Reporter', () => {
119119 expect ( spyStartSuites ) . toHaveBeenCalledTimes ( 0 ) ;
120120 } ) ;
121121
122- test ( 'should start and finish retries in case of any invocations of skipped tests' , ( ) => {
122+ test ( 'should start and finish skipped tests' , ( ) => {
123123 const spyStartStep = jest . spyOn ( reporter , '_startStep' ) ;
124124 const spyFinishStep = jest . spyOn ( reporter , '_finishStep' ) ;
125125
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-
152126 const testResult = {
153- testResults : [ skippedTestResultWithoutInvocations ] ,
127+ testResults : [ skippedTestResult ] ,
154128 testFilePath,
155129 } ;
156130
157131 reporter . onTestResult ( testObj , testResult ) ;
158132
159133 const skippedTestResultWithStartedAt = {
160134 startedAt : currentDateInMs ,
161- ...skippedTestResultWithoutInvocations ,
135+ ...skippedTestResult ,
162136 } ;
163137
164138 expect ( spyStartStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt , testObj . path ) ;
165- expect ( spyFinishStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt ) ;
139+ expect ( spyFinishStep ) . toHaveBeenCalledWith ( skippedTestResultWithStartedAt , testObj . path ) ;
166140 expect ( spyStartStep ) . toHaveBeenCalledTimes ( 1 ) ;
167141 expect ( spyFinishStep ) . toHaveBeenCalledTimes ( 1 ) ;
168142 } ) ;
@@ -312,7 +286,7 @@ describe('Reporter', () => {
312286 startTime : currentDateInMs ,
313287 retry : false ,
314288 } ;
315- const expectedTempStepIds = new Map ( [ [ 'Suite/Step' , 'startTestItem' ] ] ) ;
289+ const expectedTempStepIds = new Map ( [ [ 'example.js/ Suite/Step' , [ 'startTestItem' ] ] ] ) ;
316290
317291 expect ( reporter . client . startTestItem ) . toHaveBeenCalledWith (
318292 expectedStartStepItemParameter ,
@@ -343,19 +317,24 @@ describe('Reporter', () => {
343317 } ) ;
344318
345319 describe ( '_finishStep' , ( ) => {
320+ beforeEach ( ( ) => {
321+ reporter . tempStepIds . set ( 'example.js/suite/fake test' , [ 'tempStepId' ] ) ;
322+ } ) ;
323+
346324 test ( '_finishPassedTest should be called if step status is passed' , ( ) => {
347325 const spyFinishPassedTest = jest . spyOn ( reporter , '_finishPassedStep' ) ;
348326 const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
349327 const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
350328
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+ ) ;
359338
360339 expect ( spyFinishPassedTest ) . toHaveBeenCalled ( ) ;
361340 expect ( spyFinishFailedTest ) . not . toHaveBeenCalled ( ) ;
@@ -367,16 +346,14 @@ describe('Reporter', () => {
367346 const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
368347 const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
369348
370- reporter . tempStepIds . set ( '/fake test' , 'tempStepId' ) ;
371-
372349 reporter . _finishStep (
373350 {
374351 status : TEST_ITEM_STATUSES . FAILED ,
375352 failureMessages : [ 'error message' ] ,
376- ancestorTitles : [ ] ,
353+ ancestorTitles : [ 'suite' ] ,
377354 title : 'fake test' ,
378355 } ,
379- false ,
356+ testFilePath ,
380357 ) ;
381358
382359 expect ( spyFinishFailedTest ) . toHaveBeenCalledWith ( 'tempStepId' , 'error message' ) ;
@@ -389,14 +366,15 @@ describe('Reporter', () => {
389366 const spyFinishFailedTest = jest . spyOn ( reporter , '_finishFailedStep' ) ;
390367 const spyFinishSkippedTest = jest . spyOn ( reporter , '_finishSkippedStep' ) ;
391368
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+ ) ;
400378
401379 expect ( spyFinishSkippedTest ) . toHaveBeenCalled ( ) ;
402380 expect ( spyFinishPassedTest ) . not . toHaveBeenCalled ( ) ;
0 commit comments