{"id":22746144,"url":"https://github.com/rspack-contrib/path-serializer","last_synced_at":"2025-04-14T10:13:34.822Z","repository":{"id":252226881,"uuid":"838894029","full_name":"rspack-contrib/path-serializer","owner":"rspack-contrib","description":"Jest/Vitest snapshot path-serializer, e.g: replace \"/usr/packages\" with `\u003cROOT\u003e/packages`","archived":false,"fork":false,"pushed_at":"2024-12-02T09:53:27.000Z","size":188,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T10:13:30.976Z","etag":null,"topics":["jest","jest-serializer","snapshot","vitest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rspack-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T14:48:17.000Z","updated_at":"2025-04-08T08:25:26.000Z","dependencies_parsed_at":"2024-12-11T02:11:49.137Z","dependency_job_id":"52b18029-4359-4d39-94b5-5b71d99b6229","html_url":"https://github.com/rspack-contrib/path-serializer","commit_stats":null,"previous_names":["rspack-contrib/path-serializer"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Fpath-serializer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Fpath-serializer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Fpath-serializer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspack-contrib%2Fpath-serializer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspack-contrib","download_url":"https://codeload.github.com/rspack-contrib/path-serializer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860167,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","jest-serializer","snapshot","vitest"],"created_at":"2024-12-11T02:11:39.677Z","updated_at":"2025-04-14T10:13:34.786Z","avatar_url":"https://github.com/rspack-contrib.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# path-serializer\n\n[![npm latest version](https://img.shields.io/npm/v/path-serializer?style=flat-square\u0026color=98c379)](https://www.npmjs.com/package/path-serializer)\n\n1. stabilize pnpm dependencies path and update dependencies smoothly\n2. transform win32 path to posix path\n   and more...\n\n```ts\n// __snapshots__/index.test.ts.snap\n// 😭 bad\n{\n  \"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\"\n}\n//😎👍🏻 good\n{\n  \"loader\" : \"\u003cROOT\u003e/node_modules/\u003cPNPM_INNER\u003e/css-loader/utils.ts\"\n}\n```\n\n## Usage\n\n```typescript\n// vitest.setup.ts\nimport { createSnapshotSerializer } from 'path-serializer';\n\nexpect.addSnapshotSerializer(\n  createSnapshotSerializer({\n    root: path.join(__dirname, '..'),\n  }),\n);\n```\n\nThe specific usage can be found in [./src/types.ts](https://github.com/rspack-contrib/path-serializer/blob/main/src/types.ts)\n\n## Showcases\n\n[Rslib](https://github.com/web-infra-dev/rslib/blob/3ff6859eb38171c731e447a1364afc021f8c501a/tests/setupVitestTests.ts)\n\n[Rsbuild](https://github.com/web-infra-dev/rsbuild/blob/a50eafa3519caaa66ecd6b0ccb2897a8194781ff/scripts/test-helper/vitest.setup.ts)\n\n[Rspack](https://github.com/web-infra-dev/rspack/blob/5a6162c/packages/rspack-test-tools/src/helper/expect/placeholder.ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Fpath-serializer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspack-contrib%2Fpath-serializer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspack-contrib%2Fpath-serializer/lists"}