docs: Add targeted snapshot test guidance#10
Open
cameroncooke wants to merge 1 commit intomainfrom
Open
Conversation
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>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| 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" |
There was a problem hiding this comment.
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.
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.
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.