jest-snapshot-serializer-function-name

1.1.0 • Public • Published

jest-snapshot-serializer-function-name

Jest snapshot serializer that adds function names to snapshots

Background

Jest used to include function names in its snapshots, but doesn't anymore because of inconsistencies across node versions and problems with identifiers being rewritten when running code coverage.

If you only target one node version and don't use code coverage, then these issues don't apply to you, so function names in snapshots are likely desirable.

You can use this package to restore that functionality to jest.

Installation

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

Contributing

Pull requests and issues welcome.

Readme

Keywords

none

Package Sidebar

Install

npm i jest-snapshot-serializer-function-name

Weekly Downloads

20

Version

1.1.0

License

ISC

Unpacked Size

71.4 kB

Total Files

6

Last publish

Collaborators

  • suchipi