private recursivelyCollectChildren()

in src/test-runner/run-tracker.ts [384:409]


  private recursivelyCollectChildren(
    destination: Map<TestItemType, TestCaseInfo[]>,
    item: vscode.TestItem,
    filterLevel?: TestItemType,
    newStatus?: TestCaseStatus
  ) {
    const collectChildren = (currentItem: vscode.TestItem) => {
      const data = this.testCaseMetadata.get(currentItem)
      if (newStatus !== undefined) this.status.set(currentItem, newStatus)

      if (!data) return
      if (filterLevel !== undefined && data.type <= filterLevel) return

      // Add each test item to the appropriate map entry based on its TestItemType.
      const existingEntry = destination.get(data.type)
      if (!existingEntry) {
        destination.set(data.type, [data])
      } else {
        existingEntry.push(data)
      }

      // Recursively collect children.
      currentItem.children.forEach(child => collectChildren(child))
    }
    collectChildren(item)
  }