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
.
npm install --save-dev jss-snapshot-serializer
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);
- add tests
- add styles to snapshots