-
-
Notifications
You must be signed in to change notification settings - Fork 14
feat: support resolveSnapshotPath option
#632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the resolveSnapshotPath configuration option, allowing users to customize where snapshot files are stored. By default, Rstest saves snapshots in a __snapshots__ folder alongside test files, but this option enables alternative storage strategies like placing snapshots directly next to test files.
- Adds
resolveSnapshotPathconfiguration option to customize snapshot file locations - Updates documentation in both English and Chinese to explain the new option
- Implements the feature with a custom snapshot environment class and RPC integration
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types/config.ts | Adds resolveSnapshotPath type definition to config interface and marks it as optional |
| packages/core/src/types/worker.ts | Extends RuntimeRPC interface with resolveSnapshotPath method |
| packages/core/src/pool/index.ts | Implements default snapshot path resolution logic with fallback to __snapshots__ folder |
| packages/core/src/runtime/worker/snapshot.ts | Extends snapshot environment to support custom path resolution |
| packages/core/src/runtime/worker/index.ts | Integrates custom snapshot path resolver into worker initialization |
| website/theme/components/ConfigOverview.tsx | Adds resolveSnapshotPath to configuration overview list |
| website/docs/en/config/test/resolveSnapshotPath.mdx | Adds English documentation for the new option |
| website/docs/zh/config/test/resolveSnapshotPath.mdx | Adds Chinese documentation for the new option |
| website/docs/en/config/test/_meta.json | Registers new documentation page in English navigation |
| website/docs/zh/config/test/_meta.json | Registers new documentation page in Chinese navigation |
| e2e/snapshot/fixtures/rstest.snapshotPath.config.ts | Adds test configuration demonstrating custom snapshot path usage |
| e2e/snapshot/fixtures/index.test.ts.snap | Adds expected snapshot file for e2e test |
| e2e/snapshot/file.test.ts | Adds e2e test verifying resolveSnapshotPath functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const resolver = | ||
| context.normalizedConfig.resolveSnapshotPath || | ||
| // test/index.ts -> test/__snapshots__/index.ts.snap | ||
| (() => |
Copilot
AI
Oct 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This arrow function is defined inline but never reused. Consider extracting it to a named function getDefaultSnapshotPath for better readability and testability.
Co-authored-by: Copilot <[email protected]>
Summary
By default, Rstest saves snapshot files in the same directory as the test files, under a
__snapshots__folder.You can use
resolveSnapshotPathto customize this behavior and specify a different location for your snapshot files.For example, store snapshots next to test files:
Related Links
Checklist