Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@emotion/snapshot-serializer

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/snapshot-serializer

A snapshot serializer for jest and emotion

  • 0.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
856
decreased by-4.89%
Maintainers
2
Weekly downloads
 
Created
Source

@emotion/snapshot-serializer

A snapshot serializer for jest and emotion

@emotion/snapshot-serializer provides a jest serializer that removes hashes from emotion classes and formats the css in emotion style elements

Install

yarn add --dev @emotion/snapshot-serializer

Getting started

/** @jsx jsx */
import jsx from '@emotion/jsx'
import renderer from 'react-test-renderer'
import serializer from '@emotion/snapshot-serializer'

expect.addSnapshotSerializer(serializer)

test('style renders correctly', () => {
  expect(
    renderer
      .create(
        <div>
          <div css={{ color: 'hotpink' }}>Some hotpink text</div>
        </div>
      )
      .toJSON()
  ).toMatchSnapshot()
})

Adding it to your Jest config

You can also add the serializer to your jest config instead of adding it in each test.

{
  ...package.json
  "jest": {
    "snapshotSerializers": ["@emotion/snapshot-serializer"]
  }
}

FAQs

Package last updated on 19 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc