项目作者: yurii-sorokin

项目描述 :
Snapshot testing for an Angular application.
高级语言: TypeScript
项目地址: git://github.com/yurii-sorokin/ngx-jest-snapshot-serializer.git
创建时间: 2018-02-21T20:14:02Z
项目社区:https://github.com/yurii-sorokin/ngx-jest-snapshot-serializer

开源协议:MIT License

下载


ngx-jest-snapshot-serializer

npm
Build Status
codecov

Plugin that serializes Angular fixture components for Jest snapshot tests.

Install

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

Usage

For an individual test file:

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

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

  1. {
  2. "jest": {
  3. "snapshotSerializers": ["ngx-jest-snapshot-serializer"]
  4. }
  5. }

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.