Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-serializer-path

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-serializer-path

Remove absolute paths from your Jest snapshots

  • 0.1.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by4.48%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 25 Apr 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc