private async resolveOpenSourceFiles()

in src/test-explorer/resolver.ts [254:272]


  private async resolveOpenSourceFiles() {
    const autoExpandTarget = getExtensionSetting(SettingName.AUTO_EXPAND_TARGET)
    // When disabled, tests are discovered as the test explorer tree is expanded.
    if (!autoExpandTarget) return

    for (const doc of vscode.workspace.textDocuments) {
      // Discovery within currently open documents.
      await this.expandTargetsForDocument(doc)
    }

    if (this.openDocumentWatcherEnabled) return
    this.openDocumentWatcherEnabled = true
    this.ctx.subscriptions.push(
      vscode.workspace.onDidOpenTextDocument(async doc => {
        // Discovery within newly opened documents.
        await this.expandTargetsForDocument(doc)
      })
    )
  }