jest-serializer-path
Remove absolute paths from your Jest snapshots
Last updated 7 years ago by tribou .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install jest-serializer-path 
SYNC missed versions from official npm registry.

jest-serializer-path

npm version Linux Build Status Windows Build Status Coverage Status Project Status: Active - The project has reached a stable, usable state and is being actively developed. bitHound Code

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

Quick Start

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:

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.

# Install
npm run yarn

# Run tests
npm run test

Current Tags

  • 0.1.15                                ...           latest (7 years ago)

16 Versions

  • 0.1.15                                ...           7 years ago
  • 0.1.14                                ...           7 years ago
  • 0.1.13                                ...           7 years ago
  • 0.1.12                                ...           7 years ago
  • 0.1.11                                ...           7 years ago
  • 0.1.10                                ...           7 years ago
  • 0.1.9                                ...           7 years ago
  • 0.1.8                                ...           7 years ago
  • 0.1.7                                ...           7 years ago
  • 0.1.6                                ...           7 years ago
  • 0.1.5                                ...           7 years ago
  • 0.1.4                                ...           7 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE