From 108d1320b0f8957b13e48fc5f47e4d6ccddfd909 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:13:50 +0000 Subject: [PATCH 1/3] Initial plan From f4aa4ac94f8ad60ce83229c13871e6f8b2f14fde Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:17:26 +0000 Subject: [PATCH 2/3] docs: update readme for pnpm global virtual store Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com> --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c61e202..7e2067c 100644 --- a/README.md +++ b/README.md @@ -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 (``, ``, ``, ``) - Handle `file://` protocol URLs @@ -25,6 +25,20 @@ A snapshot serializer that normalizes system-specific paths into stable, readabl } ``` +`replacePnpmInner` also supports pnpm's global virtual store layout. When +[`enableGlobalVirtualStore`](https://pnpm.io/npmrc#enableglobalvirtualstore) is +enabled (or `.npmrc` contains `enable-global-virtual-store=true`), paths like: + +```text +/node_modules/../../../../../../Library/pnpm/store/v10/links/react/19.2.4//node_modules/react/index.js +``` + +are normalized to: + +```text +/react/index.js +``` + ## Installation ```bash @@ -147,7 +161,7 @@ Toggle individual features (all enabled by default): | `replaceRoot` | `true` | `/foo/node_modules/.pnpm` → `/node_modules/.pnpm` | | `replaceWorkspaceWithFileProtocol` | `true` | `file:///foo/packages/core/src` → `/src` | | `replaceRootWithFileProtocol` | `true` | `file:///foo/node_modules/.pnpm` → `/node_modules/.pnpm` | -| `replacePnpmInner` | `true` | Collapse pnpm's long `.pnpm/...` paths to `` | +| `replacePnpmInner` | `true` | Collapse pnpm's long `.pnpm/...` and global virtual store `pnpm/store/.../links/...` paths to `` | | `replaceTmpDir` | `true` | `os.tmpdir()` paths → `` | | `replaceHomeDir` | `true` | `os.homedir()` paths → `` | | `transformWin32Path` | `true` | Convert `D:\\foo\\bar` to `/d/foo/bar` | From f8685c6a670c23a53290a63eb75d7b1357abc37c Mon Sep 17 00:00:00 2001 From: sunyiteng Date: Tue, 17 Mar 2026 20:00:31 +0800 Subject: [PATCH 3/3] chore: upadte --- README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7e2067c..f03b1f7 100644 --- a/README.md +++ b/README.md @@ -21,24 +21,10 @@ A snapshot serializer that normalizes system-specific paths into stable, readabl // 😎 With path-serializer — stable, cross-platform, clean { - "loader" : "/node_modules//css-loader/utils.ts" + "loader" : "/css-loader/utils.ts" } ``` -`replacePnpmInner` also supports pnpm's global virtual store layout. When -[`enableGlobalVirtualStore`](https://pnpm.io/npmrc#enableglobalvirtualstore) is -enabled (or `.npmrc` contains `enable-global-virtual-store=true`), paths like: - -```text -/node_modules/../../../../../../Library/pnpm/store/v10/links/react/19.2.4//node_modules/react/index.js -``` - -are normalized to: - -```text -/react/index.js -``` - ## Installation ```bash @@ -78,6 +64,7 @@ expect.addSnapshotSerializer( ``` This replaces: + - Workspace paths → `/...` - Root paths → `/...`