private async resolveHandler()

in src/test-explorer/resolver.ts [48:120]


  private async resolveHandler(
    parentTest: vscode.TestItem | undefined,
    testExplorerCancel?: vscode.CancellationToken
  ) {
    await vscode.window.withProgress(
      {
        location: vscode.ProgressLocation.Notification,
        title: 'Refreshing Test Cases',
        cancellable: true,
      },
      async (
        progress: vscode.Progress<{
          message?: string | undefined
          increment?: number | undefined
        }>,
        notificationCancel: vscode.CancellationToken
      ) => {
        progress.report({
          increment: -1,
          message:
            'Click [here](command:bazelbsp.showServerOutput) to check progress.',
        })
        const combinedToken = combineCancelTokens(
          testExplorerCancel,
          notificationCancel
        )
        if (parentTest === undefined) {
          try {
            await this.buildServer.getConnection()
            this.resolveRoot()
          } catch (e) {
            this.outputChannel.appendLine(
              'Test explorer disabled due to lack of available build server.'
            )
          }

          return
        }

        // Wait for initialization before attempting requests to the server.
        updateDescription(
          parentTest,
          'Loading: waiting for build server initialization'
        )
        await this.buildClient.getInitializeResult()
        this.store.clearTestItemWatchers(parentTest)

        updateDescription(parentTest)
        const parentMetadata = this.store.testCaseMetadata.get(parentTest)

        switch (parentMetadata?.type) {
          case TestItemType.Root:
            progress.report({
              message:
                'Fetching test targets from build server ([progress](command:bazelbsp.showServerOutput))',
            })
            await this.resolveTargets(parentTest, combinedToken)
            break
          case TestItemType.BazelTarget:
            progress.report({
              message: `Fetching source files in ${parentMetadata.target?.displayName}`,
            })
            await this.resolveSourceFiles(parentTest, combinedToken)
            break
          case TestItemType.SourceFile:
            progress.report({
              message: `Finding test cases in ${parentMetadata.testItem.label}`,
            })
            await this.resolveDocumentTestCases(parentTest, combinedToken)
        }
      }
    )
  }