Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: fix resolveHandler not called on item replacement #209121

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

connor4312
Copy link
Member

Fixes #207574

@connor4312 connor4312 self-assigned this Mar 29, 2024
@connor4312 connor4312 enabled auto-merge (squash) March 29, 2024 16:57
@mpl1018
Copy link

mpl1018 commented Mar 29, 2024

@CodiumAI-Agent /review

@VSCodeTriageBot VSCodeTriageBot added this to the March 2024 milestone Mar 29, 2024
@CodiumAI-Agent
Copy link

PR Review

⏱️ Estimated effort to review [1-5]

3, because the PR involves changes in testing behavior and the handling of test item collections, which requires a good understanding of the existing test framework and the specific issue being addressed. The changes are spread across two files with modifications to test suite behavior and internal logic for test item handling, making it necessary to carefully review the logic and its impact on test behavior.

🧪 Relevant tests

No

🔍 Possible issues

Possible Bug: The use of timeout(0) to drain microtasks for testing purposes might not be reliable in all environments or future versions of JavaScript engines. Consider using a more explicit way of ensuring that all microtasks have been processed.

🔒 Security concerns

No

Code feedback:
relevant filesrc/vs/workbench/api/test/browser/extHostTesting.test.ts
suggestion      

Consider replacing timeout(0) with a more explicit and reliable method for ensuring all microtasks are processed. This could involve using a custom utility function designed specifically for test environments that guarantees the completion of all microtasks. [important]

relevant lineawait timeout(0); // drain microtasks

relevant filesrc/vs/workbench/contrib/testing/common/testItemCollection.ts
suggestion      

Ensure that the expandLevels property is properly managed and reset or updated as necessary after re-expansion to avoid unintended behavior. This is particularly important if the property is used elsewhere in the code to control behavior based on expansion levels. [important]

relevant lineinternal.expandLevels = undefined;

relevant filesrc/vs/workbench/contrib/testing/common/testItemCollection.ts
suggestion      

Consider adding error handling or a fallback mechanism within the queueMicrotask callback to gracefully handle any exceptions that might occur during the re-expansion process. This could improve the robustness of the test item collection handling. [medium]

relevant linequeueMicrotask(() => {


✨ Review tool usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

  • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
[pr_reviewer]
some_config1=...
some_config2=...

See the review usage page for a comprehensive guide on using this tool.

@connor4312 connor4312 merged commit e553c6b into main Mar 29, 2024
7 checks passed
@connor4312 connor4312 deleted the connor4312/issue207574 branch March 29, 2024 17:16
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestController does not call its resolveHandler on root items after they are replaced
5 participants