- stabilize pnpm dependencies path and update dependencies smoothly
- transform win32 path to posix path and more...
// __snapshots__/index.test.ts.snap
// 😭 bad
{
"loader" : "D:\\user\\rspack\\node_modules\\.pnpm\\[email protected]_@rspack+core@[email protected]_@[email protected]_@swc+helpers@0._jlcdgjlw2ezzhg43ml3d627wdu\\node_modules\\css-loader\\utils.ts"
}
//😎👍🏻 good
{
"loader" : "<ROOT>/node_modules/<PNPM_INNER>/css-loader/utils.ts"
}
// vitest.setup.ts
import { createSnapshotSerializer } from 'path-serializer';
expect.addSnapshotSerializer(
createSnapshotSerializer({
root: path.join(__dirname, '..'),
}),
);
The specific usage can be found in ./src/types.ts