Skip to content
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

Feature Request: Snapshot root directory configuration #416

Open
cosmikwolf opened this issue Oct 18, 2023 · 1 comment
Open

Feature Request: Snapshot root directory configuration #416

cosmikwolf opened this issue Oct 18, 2023 · 1 comment

Comments

@cosmikwolf
Copy link

It would be great to be able to set a directory to be the snapshot root directory, such as /tests/snapshots

This would make it possible to use snapshots in unit tests, without creating a bunch of files and directories in the src dir.

The snapshots root could replicate the necessary directory structure relative to the root dir within the snapshots root dir to ensure it maps properly to the crate root.

@mitsuhiko
Copy link
Owner

You can already do this with settings:

let mut settings = Settings::clone_current();
settings.set_snapshot_path("../tests/snapshots");
let _guard = settings.bind_to_scope();

Is this sufficient for your needs?

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

No branches or pull requests

2 participants