enzyme-to-json

  • Version 3.6.2
  • Published
  • 65.7 kB
  • 3 dependencies
  • MIT license

Install

npm i enzyme-to-json
yarn add enzyme-to-json
pnpm add enzyme-to-json

Overview

convert enzyme wrapper to a format compatible with Jest snapshot

Index

Functions

function createSerializer

createSerializer: (options?: Options) => JestSerializer;
  • createSerializer helper is used to create snapshot serializers for Jest

    Parameter options

    an option object which accepts map, noKey and mode as keys

function mountToJson

mountToJson: {
(wrapper: ReactWrapper, options?: Options): Json;
<P, S>(wrapper: ReactWrapper<P, S>, options?: Options): Json;
};
  • mountToJson helper is used to convert Enzyme mount wrappers to a format compatible with Jest snapshot

    Parameter wrapper

    an Enzyme mount wrapper

    Parameter options

    an option object which accepts map, noKey and mode as keys

function renderToJson

renderToJson: (wrapper: cheerio.Cheerio, options?: Options) => Json;
  • renderToJson helper is used to convert Enzyme render wrappers to a format compatible with Jest snapshot

    Parameter wrapper

    an Enzyme render wrapper

    Parameter options

    an option object which accepts map, noKey and mode as keys

function shallowToJson

shallowToJson: {
(wrapper: ShallowWrapper, options?: Options): Json;
<P, S>(wrapper: ShallowWrapper<P, S>, options?: Options): Json;
};
  • shallowToJson helper is used to convert Enzyme shallow wrappers to a format compatible with Jest snapshot

    Parameter wrapper

    an Enzyme shallow wrapper

    Parameter options

    an option object which accepts map, noKey and mode as keys

function toJson

toJson: {
(wrapper: CommonWrapper | cheerio.Cheerio, options?: Options): Json;
<P, S>(wrapper: any, options?: Options): Json;
};
  • toJson helper is used to convert any Enzyme wrapper to a format compatible with Jest snapshot

    Parameter wrapper

    any Enzyme wrapper

    Parameter options

    an option object which accepts map, noKey and mode as keys

Interfaces

interface JestSerializer

interface JestSerializer {}

    property print

    print: (CommonWrapper: CommonWrapper, serializer: JestSerializer) => Json;

      property test

      test: (CommonWrapper: CommonWrapper) => boolean;

        interface Json

        interface Json {}

          property $$typeof

          $$typeof: Symbol;

            property children

            children: Array<Json>;

              property props

              props: { [key: string]: any };

                property type

                type: string;

                  interface Options

                  interface Options {}

                    property ignoreDefaultProps

                    ignoreDefaultProps?: boolean;

                      property map

                      map?: OutputMapper;

                        property mode

                        mode?: 'shallow' | 'deep';

                          property noKey

                          noKey?: boolean;

                            interface OutputMapper

                            interface OutputMapper {}

                              call signature

                              (json: Json): Json;

                                Package Files (1)

                                Dependencies (3)

                                Dev Dependencies (25)

                                Peer Dependencies (1)

                                Badge

                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/enzyme-to-json.

                                • Markdown
                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/enzyme-to-json)
                                • HTML
                                  <a href="https://www.jsdocs.io/package/enzyme-to-json"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>