Skip to content

fix(test): Fix flaky SpanEvidencePreview error state test#111852

Draft
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-span-evidence-preview-spec-v2
Draft

fix(test): Fix flaky SpanEvidencePreview error state test#111852
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-span-evidence-preview-spec-v2

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

Remove unnecessary body: {} from the error mock response in the SpanEvidencePreview test for the "shows error when request fails" case.

The empty body object gets assigned as responseJSON on 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 checks if (data) before if (isError), so a truthy {} body can short-circuit the error rendering path.

This aligns the test with the identical pattern used in evidencePreview.spec.tsx and stackTracePreview.spec.tsx, which omit body from error mocks and don't exhibit this flake.

This test failed 2 times on master in the last 30 days.

Made with Cursor

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
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant