Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 594 Bytes

README.md

File metadata and controls

34 lines (24 loc) · 594 Bytes

three-snapshot-serializer

Jest snapshot serializer for THREE objects

Usage

$ npm install three-snapshot-serializer --save-dev

To use for all test files, add the following to package.json:

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

To use in one test file:

import { createSerializer } from 'three-snapshot-serializer';

expect.addSnapshotSerializer(createSerializer({ dropUUIDs: true }));

To use in one assertion:

import { toJSON } from 'three-snapshot-serializer';

expect(toJSON(obj)).matchesSnapshot();