Socket
Book a DemoInstallSign in
Socket

@machinat/jest-snapshot-serializer

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@machinat/jest-snapshot-serializer

Format Machinat JSX elements in the [jest snapshot](https://jestjs.io/docs/snapshot-testing).

latest
Source
npmnpm
Version
0.6.0
Version published
Maintainers
2
Created
Source

Jest Snapshot Serializer

Format Machinat JSX elements in the jest snapshot.

Install

npm install @machinat/jest-snapshot-serializer
# or with yarn
yarn add @machinat/jest-snapshot-serializer

Setup

Add the serializer to into jest.config.js:

module.exports = {
  // ...
  snapshotSerializers: ['@machinat/jest-snapshot-serializer'],
};

Or packages.json:

{
  "name": "my-project",
  "jest": {
    "snapshotSerializers": ["@machinat/jest-snapshot-serializer"],
  }
}

Example

expect(
  <GenericTemplate imageAspectRatio="square" sharable>
    <GenericItem
      title="foo"
      imageUrl="http://foo.bar/image"
      buttons={<UrlButton title="check" url="http://xxx.yy.z" />}
    />
  </GenericTemplate>
).toMatchInlineSnapshot(`
  <GenericTemplate
    imageAspectRatio="square"
    sharable={true}
  >
    <GenericItem
      buttons={
        <UrlButton
          title="check"
          url="http://xxx.yy.z"
        />
      }
      imageUrl="http://foo.bar/image"
      title="foo"
    />
  </GenericTemplate>
`);

FAQs

Package last updated on 08 Jun 2022

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