Skip to content

Commit 55b0789

Browse files
max-sixtyclaude
andcommitted
Fix functional tests failing under nextest (mitsuhiko#824)
## Summary - Fix `test_pending_snapshot_deletion` failing when run under nextest - Clear `NEXTEST_RUN_ID` environment variable in functional test setup When running functional tests under nextest, the `NEXTEST_RUN_ID` environment variable was inherited by child `cargo insta test` invocations. Since insta uses this variable as the `RUN_ID` for pending snapshots (see `insta/src/snapshot.rs:18`), all pending inline snapshots ended up sharing the same run_id. This broke the cleanup mechanism in `load_batch()` which keeps all entries with the last run_id. When a test passed and wrote a NULL entry to mark the snapshot as clean, the previous failing entry was also kept (same run_id), preventing the `.pending-snap` file from being deleted. ## Test plan - [x] `cargo test --package cargo-insta` passes - [x] `cargo nextest run --package cargo-insta` passes (previously failed on `test_pending_snapshot_deletion`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent de0f73d commit 55b0789

File tree

1 file changed

+3
-0
lines changed
  • cargo-insta/tests/functional

1 file changed

+3
-0
lines changed

cargo-insta/tests/functional/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ impl TestProject {
216216
cmd.env_remove("CARGO_TERM_COLOR");
217217
cmd.env_remove("CLICOLOR_FORCE");
218218
cmd.env_remove("RUSTDOCFLAGS");
219+
// Remove NEXTEST_RUN_ID so that each cargo insta test invocation gets
220+
// its own unique run_id, rather than all sharing the outer nextest's ID
221+
cmd.env_remove("NEXTEST_RUN_ID");
219222
}
220223

221224
fn insta_cmd(&self) -> Command {

0 commit comments

Comments
 (0)