Skip to content

fix: check message location visibility for failureInVisibleDocument peek#308697

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/testing-peek-visible-document-check
Open

fix: check message location visibility for failureInVisibleDocument peek#308697
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/testing-peek-visible-document-check

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

  • Fixes an issue where testing.automaticallyOpenPeekView set to failureInVisibleDocument would still open peek views in non-visible documents
  • When a test in a visible file fails with an error located in a different file (e.g. a utility module), VS Code previously opened that non-visible file just to show the peek, contradicting the setting's intent
  • Now both the test item's URI and the message location URI must be in visible editors for the peek to auto-open

Fixes #230881

Test plan

  • Set "testing.automaticallyOpenPeekView": "failureInVisibleDocument"
  • Create a test file (example.spec.ts) that calls a utility function in a separate file (util.ts) which throws an error
  • Open only example.spec.ts in the editor (ensure util.ts is NOT open)
  • Run the failing test
  • Verify the peek view does not auto-open (since the error location util.ts is not visible)
  • Now open both example.spec.ts and util.ts side by side
  • Re-run the failing test
  • Verify the peek view does auto-open (since both the test and message location are visible)

When `testing.automaticallyOpenPeekView` is set to
`failureInVisibleDocument`, the peek view should only auto-open if the
failure location is in a currently visible document. Previously, the
check only verified that the test item's URI was in a visible editor,
but not the message location URI. This meant that if a test defined in
a visible file failed with an error in a different file (e.g. a utility
module), VS Code would open that non-visible file just to show the peek
view, which contradicts the intent of the setting.

Now both the test item URI and the message location URI must be in
visible editors for the peek to auto-open.

Fixes microsoft#230881
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testing: Automatically Open Peek View with 'failureInVisibleDocument' doesn't work

2 participants