jest-snapshot-serializer-raw
jest snapshot serializer for reducing escapes in the snapshot file
(This package is modified from prettier/prettier:tests_config/raw-serializer.js@9ec1da1a
)
Changelog
Install
npm install --save-dev jest-snapshot-serializer-raw
yarn add --dev jest-snapshot-serializer-raw
Usage
{
"snapshotSerializers": ["jest-snapshot-serializer-raw"]
}
const { wrap } = require('jest-snapshot-serializer-raw');
const example = `paragraph "one"\n\n'paragraph' \\two\\`;
test('before', () => {
expect(example).toMatchSnapshot();
});
test('after', () => {
expect(wrap(example)).toMatchSnapshot();
});
exports[`before 1`] = `
"paragraph \\"one\\"
'paragraph' \\\\two\\\\"
`;
exports[`after 1`] = `
paragraph "one"
'paragraph' \\two\\
`;
Development
yarn run lint
yarn run build
yarn run test
License
MIT © Ika