Plugin that serializes Angular fixture components for Jest snapshot tests.
$ npm install --save-dev ngx-jest-snapshot-serializerFor 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 snapshot outputs could be found in the examples/ directory.
More details about snapshot plugins could be found in Pretty format package.
Highly inspired by enzyme-to-json package.