Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbkaplun/three-snapshot-serializer

Jest snapshot serializer for THREE objects
https://github.com/dbkaplun/three-snapshot-serializer

json serializer snapshot threejs

Last synced: about 1 month ago
JSON representation

Jest snapshot serializer for THREE objects

Awesome Lists containing this project

README

        

# three-snapshot-serializer
Jest snapshot serializer for THREE objects

## Usage

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

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

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

To use in one test file:

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

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

To use in one assertion:

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

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