Socket
Book a DemoInstallSign in
Socket

path-serializer

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-serializer

path-serializer

latest
Source
npmnpm
Version
0.5.1
Version published
Maintainers
1
Created
Source

path-serializer

npm latest version

  • stabilize pnpm dependencies path in snapshot
  • transform win32 path to posix path
  • escapeEOL \r\n -> \n and more...
// __snapshots__/index.test.ts.snap
// 😭 bad
{
  "loader" : "D:\\user\\rspack\\node_modules\\.pnpm\\css-loader@6.11.0_@rspack+core@packages+rspack_webpack@5.94.0_@swc+core@1.4.0_@swc+helpers@0._jlcdgjlw2ezzhg43ml3d627wdu\\node_modules\\css-loader\\utils.ts"
}
//😎👍🏻 good
{
  "loader" : "<ROOT>/node_modules/<PNPM_INNER>/css-loader/utils.ts"
}

Usage

// vitest.setup.ts
import { createSnapshotSerializer } from 'path-serializer';

expect.addSnapshotSerializer(
  createSnapshotSerializer({
    root: path.join(__dirname, '..'),
  }),
);

More features can be found in ./src/types.ts

Showcases

Rslib

Rsbuild

Rspack

Keywords

snapshot

FAQs

Package last updated on 06 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts