Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A snapshot serializer that normalizes system-specific paths into stable, readable placeholders — designed for Vitest, Jest, and Rstest.

- Stabilize pnpm dependencies path in snapshot
- Stabilize pnpm dependencies path in snapshot (including `enableGlobalVirtualStore`)
- Transform win32 path to posix path
- Replace absolute paths with placeholders (`<ROOT>`, `<WORKSPACE>`, `<HOME>`, `<TEMP>`)
- Handle `file://` protocol URLs
Expand All @@ -21,7 +21,7 @@ A snapshot serializer that normalizes system-specific paths into stable, readabl

// 😎 With path-serializer — stable, cross-platform, clean
{
"loader" : "<ROOT>/node_modules/<PNPM_INNER>/css-loader/utils.ts"
"loader" : "<PNPM_INNER>/css-loader/utils.ts"
}
```

Expand Down Expand Up @@ -64,6 +64,7 @@ expect.addSnapshotSerializer(
```

This replaces:

- Workspace paths → `<WORKSPACE>/...`
- Root paths → `<ROOT>/...`

Expand Down Expand Up @@ -147,7 +148,7 @@ Toggle individual features (all enabled by default):
| `replaceRoot` | `true` | `/foo/node_modules/.pnpm` → `<ROOT>/node_modules/.pnpm` |
| `replaceWorkspaceWithFileProtocol` | `true` | `file:///foo/packages/core/src` → `<WORKSPACE>/src` |
| `replaceRootWithFileProtocol` | `true` | `file:///foo/node_modules/.pnpm` → `<ROOT>/node_modules/.pnpm` |
| `replacePnpmInner` | `true` | Collapse pnpm's long `.pnpm/...` paths to `<PNPM_INNER>` |
| `replacePnpmInner` | `true` | Collapse pnpm's long `.pnpm/...` and global virtual store `pnpm/store/.../links/...` paths to `<PNPM_INNER>` |
| `replaceTmpDir` | `true` | `os.tmpdir()` paths → `<TEMP>` |
| `replaceHomeDir` | `true` | `os.homedir()` paths → `<HOME>` |
| `transformWin32Path` | `true` | Convert `D:\\foo\\bar` to `/d/foo/bar` |
Expand Down
Loading