Skip to content

fix(vscode): Unable to use the “Run Tests in File or Folder” feature#920

Merged
fi3ework merged 1 commit intomainfrom
fix-vscode-run-tests-in-file
Jan 30, 2026
Merged

fix(vscode): Unable to use the “Run Tests in File or Folder” feature#920
fi3ework merged 1 commit intomainfrom
fix-vscode-run-tests-in-file

Conversation

@claneo
Copy link
Copy Markdown
Collaborator

@claneo claneo commented Jan 29, 2026

Summary

This pr fixes No tests found in the selected file or folder error.

The uri of a test item must either be unset or be the parent uri of its children.

https://github.com/microsoft/vscode/blob/3b42759b8b501e68106c72b5683dcc114ed789e1/src/vs/workbench/contrib/testing/common/testService.ts#L278-L280

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @claneo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue preventing the proper functioning of the 'Run Tests in File or Folder' feature within VSCode. The fix involves a targeted adjustment to how test items are initialized, alongside an update to task configurations to ensure robust problem matching for background build processes. The overall impact is improved reliability and usability of the VSCode extension's testing and development workflows.

Highlights

  • VSCode Test Runner Fix: The uri argument is no longer passed when creating a TestItem in packages/vscode/src/project.ts. This change directly addresses an issue where VSCode's 'Run Tests in File or Folder' feature was failing to find tests, as indicated by the inline comment referencing a VSCode source code line.
  • VSCode Task Problem Matcher Updates: The .vscode/tasks.json file has been updated to replace shorthand problem matcher references ($rslib-watch) with explicit, inline problem matcher definitions for several npm dev and npm watch:local tasks. This ensures correct background task detection and error reporting within VSCode for these build processes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses the issue of the “Run Tests in File or Folder” feature not working in VSCode. The fix involves two main changes: first, explicitly defining the problemMatcher configuration in .vscode/tasks.json for several npm tasks, moving away from a named reference. Second, it removes the uri argument when creating vscode.TestItem instances in packages/vscode/src/project.ts, which was causing the test runner to fail. These changes improve the robustness of the VSCode extension's build process and resolve a critical bug in test discovery.

@claneo claneo marked this pull request as ready for review January 29, 2026 09:49
Copilot AI review requested due to automatic review settings January 29, 2026 09:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the "No tests found in the selected file or folder" error in VSCode by correcting the URI parameter passed to test item creation. The issue occurred because VSCode requires that a test item's URI must either be unset or be the parent URI of all its children, but the Project test item was using the config file URI which is not a parent of the test files.

Changes:

  • Removed the uri parameter from Project test item creation to comply with VSCode's test service requirements
  • Inlined problem matcher definitions in VSCode tasks configuration

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/vscode/src/project.ts Fixed Project test item creation by removing the configFileUri parameter, ensuring VSCode's "Run Tests" feature works correctly
.vscode/tasks.json Inlined problem matcher definitions for build tasks (replacing references to "$rslib-watch" with explicit inline definitions)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fi3ework fi3ework enabled auto-merge (squash) January 30, 2026 03:34
@fi3ework
Copy link
Copy Markdown
Member

thank u

@fi3ework fi3ework merged commit 099a5bd into main Jan 30, 2026
29 of 33 checks passed
@fi3ework fi3ework deleted the fix-vscode-run-tests-in-file branch January 30, 2026 03:36
@fi3ework fi3ework mentioned this pull request Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants