ngx-jest-snapshot-serializer

2.0.0 • Public • Published

ngx-jest-snapshot-serializer

npm Build Status codecov

Plugin that serializes Angular fixture components for Jest snapshot tests.

Install

$ npm install --save-dev ngx-jest-snapshot-serializer

Usage

For an individual test file:

import serializer from 'ngx-jest-snapshot-serializer';
expect.addSnapshotSerializer(serializer);

For all test files, you need to specify serializer in Jest configuration. For example, in a package.json file:

{
  "jest": {
    "snapshotSerializers": ["ngx-jest-snapshot-serializer"]
  }
}

If you do not set up jest testing in your Angular application yet then look at this preset.

Example

Example snapshot outputs could be found in the examples/ directory.

Further reading

More details about snapshot plugins could be found in Pretty format package.


Highly inspired by enzyme-to-json package.

Package Sidebar

Install

npm i ngx-jest-snapshot-serializer

Weekly Downloads

54

Version

2.0.0

License

MIT

Unpacked Size

1.72 MB

Total Files

1501

Last publish

Collaborators

  • fortywinkz