Skip to content

docs: Add targeted snapshot test guidance#10

Open
cameroncooke wants to merge 1 commit intomainfrom
cameroncooke/docs/snapshot-test-guidance
Open

docs: Add targeted snapshot test guidance#10
cameroncooke wants to merge 1 commit intomainfrom
cameroncooke/docs/snapshot-test-guidance

Conversation

@cameroncooke
Copy link
Copy Markdown
Collaborator

Add contributor docs for targeted snapshot test workflows.

The testing guide already covered full snapshot runs and fixture regeneration, but it did not explain how to add a new snapshot test case, how fixture scenario names map to fixture paths, or how to run and update a single targeted snapshot test. This adds those practical examples so contributors can iterate without running the full snapshot suite every time.

The examples focus on the device suite because it is a common source of environment-sensitive fixture updates.

Document how contributors add snapshot test cases, map fixture names to paths, and run or update targeted snapshot tests. This makes fixture maintenance easier without requiring a full snapshot-suite run for every iteration.

Co-Authored-By: Claude Code Sonnet <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
xcodebuildmcp-com Ready Ready Preview, Comment Apr 28, 2026 3:14pm

Request Review

@cameroncooke cameroncooke marked this pull request as ready for review April 28, 2026 15:15
Combine `UPDATE_SNAPSHOTS=1` with a file filter and `-t` to regenerate only the matched fixtures:

```shell
UPDATE_SNAPSHOTS=1 npx vitest run --config vitest.snapshot.config.ts src/snapshot-tests/__tests__/device.snapshot.test.ts -t "list success"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The documented Vitest filter command -t "list success" may not work if tests are nested, as Vitest uses > as a separator, not a space.
Severity: MEDIUM

Suggested Fix

Verify the actual test suite structure in the getsentry/XcodeBuildMCP repository. If tests are nested, update the command in the documentation to use the correct separator, for example: -t "list > success". Alternatively, clarify the documentation by showing the exact describe/it structure that results in the documented command working correctly.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: app/docs/_content/testing.mdx#L147

Potential issue: The documentation for running snapshot tests provides a Vitest filter
command, `-t "list success"`, to run a specific test. However, Vitest's official
documentation specifies that nested `describe` and `it` blocks are separated by a `>`
character in the full test name (e.g., `"list > success"`). The provided command uses a
space, which would only work if the test name was flat, like `it('list success', ...)`.
Because the actual test suite structure is not shown and nesting is a common pattern,
the documented command is likely to silently fail by matching zero tests, causing
confusion for contributors trying to use this feature.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

1 participant