# jest-serializer-path

> Remove absolute paths from your Jest snapshots

Latest version **0.1.15** (published 2018-04-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install jest-serializer-path
pnpm add jest-serializer-path
yarn add jest-serializer-path
bun add jest-serializer-path
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.15 |
| Published | 2018-04-25 |
| First published | 2017-05-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.4.x |
| Dependencies | 3 |
| Unpacked size | 172.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | tribou |
| Maintainers | tribou |
| Keywords | jest, serializer |

## Links

- npm: https://www.npmjs.com/package/jest-serializer-path
- Repository: https://github.com/tribou/jest-serializer-path
- Homepage: https://github.com/tribou/jest-serializer-path#readme
- Issues: https://github.com/tribou/jest-serializer-path/issues
- npm.io page: https://npm.io/package/jest-serializer-path

## Dependencies (3)

- [slash](https://npm.io/package/slash.md) ^2.0.0
- [lodash.iserror](https://npm.io/package/lodash.iserror.md) ^3.1.1
- [lodash.clonedeep](https://npm.io/package/lodash.clonedeep.md) ^4.5.0

## Recent versions

- 0.1.15 (latest) — 2018-04-25
- 0.1.14 — 2018-04-24
- 0.1.13 — 2018-04-11
- 0.1.12 — 2018-04-10
- 0.1.11 — 2018-04-04
- 0.1.10 — 2018-04-02
- 0.1.9 — 2018-03-29
- 0.1.8 — 2018-03-27
- 0.1.7 — 2018-03-25
- 0.1.6 — 2018-02-08
- 0.1.5 — 2017-11-24
- 0.1.4 — 2017-11-24
- 0.1.3 — 2017-07-07
- 0.1.2 — 2017-06-17
- 0.1.0 — 2017-05-06
- … 1 more at https://npm.io/package/jest-serializer-path/versions

## README

# jest-serializer-path

[![npm version](https://badge.fury.io/js/jest-serializer-path.svg)](https://badge.fury.io/js/jest-serializer-path)
[![Linux Build Status](https://img.shields.io/circleci/project/github/tribou/jest-serializer-path/master.svg?label=linux%20build)](https://circleci.com/gh/tribou/jest-serializer-path/tree/master)
[![Windows Build Status](https://img.shields.io/appveyor/ci/tribou/jest-serializer-path/master.svg?label=windows%20build)](https://ci.appveyor.com/project/tribou/jest-serializer-path/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/tribou/jest-serializer-path/badge.svg?branch=master)](https://coveralls.io/github/tribou/jest-serializer-path?branch=master)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![bitHound Code](https://www.bithound.io/github/tribou/jest-serializer-path/badges/code.svg)](https://www.bithound.io/github/tribou/jest-serializer-path)

Remove absolute paths and normalize paths across all platforms in your Jest snapshots.

#### Quick Start

```bash
npm install --save-dev jest-serializer-path
```

Add this to your `package.json` Jest config:

```
"jest": {
  "snapshotSerializers": [
    "jest-serializer-path"
  ]
}
```

Or include only in individual tests:

```js
const serializer = require('jest-serializer-path')

expect.addSnapshotSerializer(serializer)
```

All absolute paths will now be converted and saved in snapshots like so:

`/path/to/my-proj/lib` => `<PROJECT_ROOT>/lib`

``/path/to/os-temp/nested/temp`` => ``<TEMP_DIR>/nested/temp``

``/path/to/user-home/nested/home`` => ``<HOME_DIR>/nested/home``

#### Caveats

* All single backslashes (`\`) will be replaced by a forward slash (`/`).
* Any string that looks like a Windows drive letter (`C:\`) will be replaced by a forward slash (`/`).

#### Build

This project bundles the yarn executable and the npm/yarn dependencies offline
in the `.npm-packages-offline-cache` directory for faster dependency installs
and better dev/prod parity across including preventing failure if yarn/npm is
offline.

```sh
# Install
npm run yarn

# Run tests
npm run test
```

---
_Source: https://npm.io/package/jest-serializer-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
