Make snapshot updates possible without modifying test code #564
+142
−2
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.
Why
Updating test snapshots required modifying constants inside the test suite.
This made the workflow unnecessarily awkward and error-prone:
As a result, contributors could not easily refresh snapshots, raising
the barrier for maintaining or improving tests.
This PR introduces a simple environment-based switch so contributors can
update snapshots without touching the codebase.
What
New environment variables
UPDATE_EMBED_SNAPSHOTS=1EMBED_STRICT_CACHE=1Developer workflow
Developers can now refresh snapshots with a single command:
No code edits and no numeric flags are required.
CI updates
GitHub Actions now runs with:
to ensure snapshot files are always present and up to date.
Documentation
A new "Testing" section has been added to the README, describing how
snapshots are updated and how strict mode behaves in CI.
Usage Examples
Execute result
Update success on Linux, please open details.
env(docker)
Execute output
on macOS error sample
But failed on MY mac. It’s probably due to macOS resource limitations, and I could not solve fails.
But It succeeds on Linux, so I don’t think the code itself is incorrect.