Files
bun.sh/test/regression/issue
Claude Bot 628cb33cea fix: preserve snapshot ordering when updating snapshots
Fixes snapshot tests so that when using -u to update snapshots, the
order of snapshots in the file is preserved instead of being rewritten
in test execution order.

This also fixes using -u in combination with -t test filters.

**Problem:**
When updating snapshots with the -u flag, the entire snapshot file was
being truncated and rewritten in the order tests execute, causing:
1. Large diffs in version control
2. Confusing order changes
3. Issues when using -t filters to update specific snapshots

**Solution:**
- Track the location of each snapshot in the file using a LocationsHashMap
- When updating a snapshot, replace it in-place rather than rewriting the entire file
- Preserve the original formatting (leading newlines) when updating
- Only read the file once (don't truncate on update mode)

**Changes:**
- Added SnapshotLocation struct to track start/end offsets
- Added locations HashMap to Snapshots struct
- Modified parseFile to track snapshot locations as it parses
- Modified getOrPut to update snapshots in-place when update_snapshots is true
- Removed O.TRUNC flag from file opening in update mode
- Added regression test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 02:45:32 +00:00
..
2025-08-06 06:44:46 -07:00
2025-01-28 17:23:57 -08:00
2025-06-03 13:23:12 -07:00
2025-06-03 23:41:37 -07:00
2025-01-17 22:08:07 -08:00
2024-06-14 01:50:36 -07:00
2025-03-03 21:38:05 -08:00
2025-05-26 21:18:22 -07:00
2025-07-03 01:06:22 -07:00
2025-07-23 22:31:42 -07:00
2025-07-20 23:02:10 -07:00