File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ import { TestCase } from '@playwright/test/reporter';
8
8
* NOTE: This does not return the entire body of a TestCase, only the TestSteps
9
9
*/
10
10
export function getLines ( testCase : TestCase ) {
11
+ if ( testCase . results . length === 0 ) {
12
+ return [ ] ;
13
+ }
14
+
11
15
const result = testCase . results [ testCase . results . length - 1 ] ;
12
16
const stepLines = result . steps
13
17
. map ( ( step ) => step . location ?. line )
Original file line number Diff line number Diff line change @@ -361,12 +361,25 @@ export default class SauceReporter implements Reporter {
361
361
const assets : Asset [ ] = [ ] ;
362
362
363
363
for ( const testCase of rootSuite . tests ) {
364
- const lastResult = testCase . results [ testCase . results . length - 1 ] ;
364
+ let lastResult = testCase . results [ testCase . results . length - 1 ] ;
365
365
366
- // TestCase can have 0 results if it was skipped with the skip annotation or
367
- // if it was filtered with the grep cli flag
366
+ // TestCase can have 0 results if it was skipped with the skip annotation,
367
+ // filtered with the grep cli flag or never executed due to early
368
+ // termination, such as the fail-fast option `maxFailures`.
368
369
if ( ! lastResult ) {
369
- break ;
370
+ lastResult = {
371
+ duration : 0 ,
372
+ errors : [ ] ,
373
+ parallelIndex : 0 ,
374
+ retry : 0 ,
375
+ startTime : this . startedAt || new Date ( ) ,
376
+ status : 'skipped' ,
377
+ stderr : [ ] ,
378
+ stdout : [ ] ,
379
+ steps : [ ] ,
380
+ workerIndex : 0 ,
381
+ attachments : [ ] ,
382
+ } ;
370
383
}
371
384
372
385
const lines = getLines ( testCase ) ;
You can’t perform that action at this time.
0 commit comments