string-snapshot-serializer

serializer for string escape

Usage no npm install needed!

<script type="module">
  import stringSnapshotSerializer from 'https://cdn.skypack.dev/string-snapshot-serializer';
</script>

README

string-snapshot-serializer

Build Status tested with jest styled with prettier All Contributors

serializer for string escape

Install

$ npm install string-snapshot-serializer

Usage

import { getSnapshotSerializer } from 'string-snapshot-serializer'

expect.addSnapshotSerializer(getSnapshotSerializer())
before:
exports[`snapshot`] = `"test \\"unicorn\\""`;

after:
exports[`snapshot`] = `test "unicorn"`;

...or add it globally to your jest config:

// jest.config.js
module.exports = {
  snapshotSerializers: [
    require.resolve('string-snapshot-serializer/serializer.js'),
  ],
}

Contributors

Thanks goes to these wonderful people (emoji key):


akameco

💻 📖 ⚠️ 🚇

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © akameco