fix(vscode): Unable to use the “Run Tests in File or Folder” feature#920
fix(vscode): Unable to use the “Run Tests in File or Folder” feature#920
Conversation
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
uriparameter 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.
|
thank u |
Summary
This pr fixes
No tests found in the selected file or foldererror.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