ngx-jest-snapshot-serializer
v2.0.0
Published
Snapshot testing for an Angular application
Downloads
317
Maintainers
Readme
ngx-jest-snapshot-serializer
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.