Skip to content

dev-theory/jss-snapshot-serializer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jss-snapshot-serializer

Jest snapshot serializer for JSS

At the moment, the functionality of this serializer is limited to stripping out the "dynamic" part of the JSS-generated class names to avoid false positive changes to the snapshot every time the snapshot is re-generated.

This fork is focused on the JSS class names generated by the material-ui implementation of createGenerateClassName.

Install

npm install --save-dev jss-snapshot-serializer

Usage

To use the serializer globally for all your tests put the following option to your Jest config:

{
  snapshotSerializers: ['jss-snapshot-serializer']
}

Alternatively, you can add the serializer to a specific test file like this:

import jssSerializer from 'jss-snapshot-serializer';
expect.addSnapshotSerializer(jssSerializer);

TODO

  • add tests
  • add styles to snapshots

About

Jest snapshot serializer for JSS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%