fix(test): Fix flaky SpanEvidencePreview error state test#111852
Draft
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
Draft
fix(test): Fix flaky SpanEvidencePreview error state test#111852JoshuaKGoldberg wants to merge 1 commit intomasterfrom
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
Conversation
Remove unnecessary `body: {}` from the error mock response that could
interfere with error state detection. The empty body object gets set as
`responseJSON` on the error, which in edge timing cases under CI load
may briefly resolve the query with data before the error propagates.
Also wrap the assertion with `expect(...).toBeInTheDocument()` for
consistency with similar tests in the codebase.
Co-Authored-By: Claude Sonnet 4 <[email protected]>
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove unnecessary
body: {}from the error mock response in theSpanEvidencePreviewtest for the "shows error when request fails" case.The empty body object gets assigned as
responseJSONon the error response object, which in edge timing cases under CI load may briefly cause the query to resolve with data before the error propagates — the component checksif (data)beforeif (isError), so a truthy{}body can short-circuit the error rendering path.This aligns the test with the identical pattern used in
evidencePreview.spec.tsxandstackTracePreview.spec.tsx, which omitbodyfrom error mocks and don't exhibit this flake.This test failed 2 times on master in the last 30 days.
Made with Cursor