npm.io
1.0.0 • Published 9 years ago

jest-snapshot-serializer-class-name-to-string

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0

jest-snapshot-serializer-class-name-to-string

Jest snapshot serializer that call .toString on className react props.

Background

React by default call .toString method on not string values given to className props, default jest serializer - don't.

You can use this package to add this functionality to jest.

Installation

  • Add the package to your project using npm or yarn
$ npm install --save-dev jest-snapshot-serializer-class-name-to-string
# OR
$ yarn add --dev jest-snapshot-serializer-class-name-to-string
  • Edit the snapshotSerializers section of your jest configuration:
// package.json
{
  ...
  "jest": {
    "snapshotSerializers": ["jest-snapshot-serializer-class-name-to-string"]
  }
}
  • Run jest -u to update your snapshots

Contributing

Pull requests and issues welcome.