@@ -7,7 +7,6 @@ import type {
77 TaskMeta ,
88} from '@vitest/runner'
99import type { TestError } from '@vitest/utils'
10- import { getTestName } from '../../utils/tasks'
1110import type { WorkspaceProject } from '../workspace'
1211import { TestProject } from '../reported-workspace-project'
1312
@@ -101,7 +100,12 @@ export class TestCase extends ReportedTaskImplementation {
101100 */
102101 public get fullName ( ) : string {
103102 if ( this . #fullName === undefined ) {
104- this . #fullName = getTestName ( this . task , ' > ' )
103+ if ( this . parent . type !== 'module' ) {
104+ this . #fullName = `${ this . parent . fullName } > ${ this . name } `
105+ }
106+ else {
107+ this . #fullName = this . name
108+ }
105109 }
106110 return this . #fullName
107111 }
@@ -198,7 +202,7 @@ class TestCollection {
198202 /**
199203 * Filters all tests that are part of this collection and its children.
200204 */
201- * allTests ( state ?: TestResult [ 'state' ] | 'running' ) : IterableIterator < TestCase > {
205+ * allTests ( state ?: TestResult [ 'state' ] | 'running' ) : Generator < TestCase , undefined , void > {
202206 for ( const child of this ) {
203207 if ( child . type === 'suite' ) {
204208 yield * child . children . allTests ( state )
@@ -218,7 +222,7 @@ class TestCollection {
218222 /**
219223 * Filters only the tests that are part of this collection.
220224 */
221- * tests ( state ?: TestResult [ 'state' ] | 'running' ) : IterableIterator < TestCase > {
225+ * tests ( state ?: TestResult [ 'state' ] | 'running' ) : Generator < TestCase , undefined , void > {
222226 for ( const child of this ) {
223227 if ( child . type !== 'test' ) {
224228 continue
@@ -239,7 +243,7 @@ class TestCollection {
239243 /**
240244 * Filters only the suites that are part of this collection.
241245 */
242- * suites ( ) : IterableIterator < TestSuite > {
246+ * suites ( ) : Generator < TestSuite , undefined , void > {
243247 for ( const child of this ) {
244248 if ( child . type === 'suite' ) {
245249 yield child
@@ -250,7 +254,7 @@ class TestCollection {
250254 /**
251255 * Filters all suites that are part of this collection and its children.
252256 */
253- * allSuites ( ) : IterableIterator < TestSuite > {
257+ * allSuites ( ) : Generator < TestSuite , undefined , void > {
254258 for ( const child of this ) {
255259 if ( child . type === 'suite' ) {
256260 yield child
@@ -259,7 +263,7 @@ class TestCollection {
259263 }
260264 }
261265
262- * [ Symbol . iterator ] ( ) : IterableIterator < TestSuite | TestCase > {
266+ * [ Symbol . iterator ] ( ) : Generator < TestSuite | TestCase , undefined , void > {
263267 for ( const task of this . #task. tasks ) {
264268 yield getReportedTask ( this . #project, task ) as TestSuite | TestCase
265269 }
@@ -328,7 +332,12 @@ export class TestSuite extends SuiteImplementation {
328332 */
329333 public get fullName ( ) : string {
330334 if ( this . #fullName === undefined ) {
331- this . #fullName = getTestName ( this . task , ' > ' )
335+ if ( this . parent . type !== 'module' ) {
336+ this . #fullName = `${ this . parent . fullName } > ${ this . name } `
337+ }
338+ else {
339+ this . #fullName = this . name
340+ }
332341 }
333342 return this . #fullName
334343 }
0 commit comments