Context
tests/snapshot_tests.rs::snapshot_version_format currently asserts the exact version string output by ssh-cli --version. The snapshot file tests/snapshots/snapshot_tests__version_format.snap must be manually updated on every release bump.
During v0.2.1 release (pin for elliptic-curve), this test failed because the snapshot expected ssh-cli 0.1.0 (HASH) but build produced ssh-cli 0.2.1 (HASH).
Proposal
Make the test redact the version string in addition to the hash:
// Current (line 62-70 of tests/snapshot_tests.rs)
let redacted = if let Some(start) = stdout.find('(') {
if let Some(end) = stdout.find(')') {
format!("{}(HASH){}", &stdout[..start], &stdout[end + 1..])
} else {
stdout
}
} else {
stdout
};
// Proposed: redact version too
// Regex: `ssh-cli <version> (<hash>)` -> `ssh-cli VERSION (HASH)`
Use regex or simple parse to replace the version number with VERSION placeholder. The snapshot would become stable across releases: ssh-cli VERSION (HASH).
Benefits
- CI failures on version bump are eliminated.
- Test focuses on the FORMAT of
--version output, not the literal version.
- Snapshot file becomes immutable between releases.
Priority
Low (quality-of-life). Current workaround: manually update snapshot on each release.
Context
tests/snapshot_tests.rs::snapshot_version_formatcurrently asserts the exact version string output byssh-cli --version. The snapshot filetests/snapshots/snapshot_tests__version_format.snapmust be manually updated on every release bump.During v0.2.1 release (pin for elliptic-curve), this test failed because the snapshot expected
ssh-cli 0.1.0 (HASH)but build producedssh-cli 0.2.1 (HASH).Proposal
Make the test redact the version string in addition to the hash:
Use
regexor simple parse to replace the version number withVERSIONplaceholder. The snapshot would become stable across releases:ssh-cli VERSION (HASH).Benefits
--versionoutput, not the literal version.Priority
Low (quality-of-life). Current workaround: manually update snapshot on each release.