Skip to content

Commit f97ac39

Browse files
authored
refactor(runner): eagerly set file property during task creation (#9127)
1 parent 4c75492 commit f97ac39

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

packages/runner/src/suite.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ function createSuiteCollector(
313313
fails: options.fails,
314314
context: undefined!,
315315
type: 'test',
316-
file: undefined!,
316+
file: (currentSuite?.file ?? collectorContext.currentSuite?.file)!,
317317
timeout,
318318
retry: options.retry ?? runner.config.retry,
319319
repeats: options.repeats,
@@ -461,7 +461,7 @@ function createSuiteCollector(
461461
suite: currentSuite,
462462
mode,
463463
each,
464-
file: undefined!,
464+
file: (currentSuite?.file ?? collectorContext.currentSuite?.file)!,
465465
shuffle: suiteOptions?.shuffle,
466466
tasks: [],
467467
meta: Object.create(null),
@@ -505,13 +505,8 @@ function createSuiteCollector(
505505
allChildren.push(i.type === 'collector' ? await i.collect(file) : i)
506506
}
507507

508-
suite.file = file
509508
suite.tasks = allChildren
510509

511-
allChildren.forEach((task) => {
512-
task.file = file
513-
})
514-
515510
return suite
516511
}
517512

0 commit comments

Comments
 (0)