@types/enzyme

  • Version 3.10.18
  • Published
  • 33.9 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/enzyme
yarn add @types/enzyme
pnpm add @types/enzyme

Overview

TypeScript definitions for enzyme

Index

Functions

Classes

Interfaces

Type Aliases

Functions

function configure

configure: (options: {
adapter: EnzymeAdapter;
disableLifecycleMethods?: boolean | undefined;
}) => void;
  • Configure enzyme to use the correct adapter for the react version This is enabling the Enzyme configuration with adapters in TS

function mount

mount: {
<C extends Component, P = C['props'], S = C['state']>(
node: ReactElement<P>,
options?: MountRendererProps
): ReactWrapper<P, S, C>;
<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<
P,
any,
Component
>;
<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<
P,
S,
Component
>;
};
  • Mounts and renders a react component into the document and provides a testing wrapper around it.

function render

render: <P, S>(node: ReactElement<P>, options?: any) => cheerio.Cheerio;
  • Render react components to static HTML and analyze the resulting HTML structure.

function shallow

shallow: {
<C extends Component, P = C['props'], S = C['state']>(
node: ReactElement<P>,
options?: ShallowRendererProps
): ShallowWrapper<P, S, C>;
<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<
P,
any,
Component
>;
<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<
P,
S,
Component
>;
};
  • Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that your tests aren't indirectly asserting on behavior of child components.

Classes

class ElementClass

class ElementClass extends Component<any, any> {}

    class EnzymeAdapter

    class EnzymeAdapter {}

      property wrapWithWrappingComponent

      wrapWithWrappingComponent?: (
      node: ReactElement,
      options?: ShallowRendererProps
      ) => any;

        class ReactWrapper

        class ReactWrapper<P = {}, S = {}, C = Component> {}

          constructor

          constructor(
          nodes: any,
          root?: ReactWrapper<any, any, Component>,
          options?: MountRendererProps
          );

            property getWrappingComponent

            getWrappingComponent: () => ReactWrapper;
            • If a wrappingComponent was passed in options, this methods returns a ReactWrapper around the rendered wrappingComponent. This ReactWrapper can be used to update the wrappingComponent's props and state

            method childAt

            childAt: {
            (index: number): ReactWrapper<any, any>;
            <P2, S2>(index: number): ReactWrapper<P2, S2, Component>;
            };
            • Returns a new wrapper with child at the specified index.

            method children

            children: {
            <P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
            <P2>(component: ComponentType<P2>): ReactWrapper<P2, any, Component>;
            (selector: string): ReactWrapper<any, any, Component>;
            (props?: EnzymePropSelector): ReactWrapper<any, any, Component>;
            };
            • Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector can be provided and it will filter the children by this selector.

            method closest

            closest: {
            <P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
            <P2>(component: ComponentType<P2>): ReactWrapper<P2, any, Component>;
            (props: EnzymePropSelector): ReactWrapper<any, any, Component>;
            (selector: string): ReactWrapper<any, any, Component>;
            };
            • Returns a wrapper of the first element that matches the selector by traversing up through the current node's ancestors in the tree, starting with itself.

              Note: can only be called on a wrapper of a single node.

            method detach

            detach: () => void;
            • Detaches the react tree from the DOM. Runs ReactDOM.unmountComponentAtNode() under the hood.

              This method will most commonly be used as a "cleanup" method if you decide to use the attachTo option in mount(node, options).

              The method is intentionally not "fluent" (in that it doesn't return this) because you should not be doing anything with this wrapper after this method is called.

              Using the attachTo is not generally recommended unless it is absolutely necessary to test something. It is your responsibility to clean up after yourself at the end of the test if you do decide to use it, though.

            method filter

            filter: {
            <P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
            <P2>(component: ComponentType<P2>): ReactWrapper<P2, any, Component>;
            (props: string | EnzymePropSelector): ReactWrapper<P, S, Component>;
            };
            • Removes nodes in the current wrapper that do not match the provided selector.

              Parameter selector

              The selector to match.

            method find

            find: {
            <P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
            <P2>(component: ComponentType<P2>): ReactWrapper<P2, any, Component>;
            <C2 extends Component>(
            componentClass: ComponentClass<C2['props']>
            ): ReactWrapper<C2['props'], C2['state'], C2>;
            (props: EnzymePropSelector): ReactWrapper<any, any, Component>;
            (selector: string): ReactWrapper<any, any, Component>;
            };
            • Find every node in the render tree that matches the provided selector.

              Parameter selector

              The selector to match.

            method findWhere

            findWhere: (
            predicate: (wrapper: ReactWrapper<any, any>) => boolean
            ) => ReactWrapper<any, any>;
            • Finds every node in the render tree that returns true for the provided predicate function.

            method hostNodes

            hostNodes: () => ReactWrapper<HTMLAttributes>;
            • Strips out all the not host-nodes from the list of nodes

              This method is useful if you want to check for the presence of host nodes (actually rendered HTML elements) ignoring the React nodes.

            method mount

            mount: () => this;

              method parent

              parent: () => ReactWrapper<any, any>;
              • Returns a wrapper with the direct parent of the node in the current wrapper.

              method parents

              parents: {
              <P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
              <P2>(component: ComponentType<P2>): ReactWrapper<P2, any, Component>;
              (selector: string): ReactWrapper<any, any, Component>;
              (props?: EnzymePropSelector): ReactWrapper<any, any, Component>;
              };
              • Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.

                Note: can only be called on a wrapper of a single node.

              method ref

              ref: {
              (refName: string): ReactWrapper<any, any>;
              <P2, S2>(refName: string): ReactWrapper<P2, S2, Component>;
              };
              • Returns a wrapper of the node that matches the provided reference name.

                NOTE: can only be called on a wrapper instance that is also the root instance.

              method renderProp

              renderProp: <PropName extends keyof P>(
              prop: PropName
              ) => (...params: Parameters<P[PropName]>) => ReactWrapper<any, never>;
              • Returns a wrapper of the node rendered by the provided render prop.

              method unmount

              unmount: () => this;

                class ShallowWrapper

                class ShallowWrapper<P = {}, S = {}, C = Component> {}

                  constructor

                  constructor(
                  nodes: any,
                  root?: ShallowWrapper<any, any, Component>,
                  options?: ShallowRendererProps
                  );

                    property getWrappingComponent

                    getWrappingComponent: () => ShallowWrapper;
                    • If a wrappingComponent was passed in options, this methods returns a ShallowWrapper around the rendered wrappingComponent. This ShallowWrapper can be used to update the wrappingComponent's props and state

                    method childAt

                    childAt: {
                    (index: number): ShallowWrapper<any, any>;
                    <P2, S2>(index: number): ShallowWrapper<P2, S2, Component>;
                    };
                    • Returns a new wrapper with child at the specified index.

                    method children

                    children: {
                    <P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
                    <P2>(component: ComponentType<P2>): ShallowWrapper<P2, any, Component>;
                    (selector: string): ShallowWrapper<any, any, Component>;
                    (props?: EnzymePropSelector): ShallowWrapper<any, any, Component>;
                    };
                    • Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector can be provided and it will filter the children by this selector.

                    method closest

                    closest: {
                    <P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
                    <P2>(component: ComponentType<P2>): ShallowWrapper<P2, any, Component>;
                    (props: EnzymePropSelector): ShallowWrapper<any, any, Component>;
                    (selector: string): ShallowWrapper<any, any, Component>;
                    };
                    • Returns a wrapper of the first element that matches the selector by traversing up through the current node's ancestors in the tree, starting with itself.

                      Note: can only be called on a wrapper of a single node.

                    method dive

                    dive: {
                    <C2 extends Component, P2 = C2['props'], S2 = C2['state']>(
                    options?: ShallowRendererProps
                    ): ShallowWrapper<P2, S2, C2>;
                    <P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2, Component>;
                    <P2, S2, C2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2, C2>;
                    };
                    • Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result. NOTE: can only be called on wrapper of a single non-DOM component element node.

                    method filter

                    filter: {
                    <P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
                    <P2>(component: ComponentType<P2>): ShallowWrapper<P2, any, Component>;
                    (props: string | EnzymePropSelector): ShallowWrapper<P, S, Component>;
                    };
                    • Removes nodes in the current wrapper that do not match the provided selector.

                      Parameter selector

                      The selector to match.

                    method find

                    find: {
                    <P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
                    <P2>(component: ComponentType<P2>): ShallowWrapper<P2, any, Component>;
                    <C2 extends Component>(
                    componentClass: ComponentClass<C2['props']>
                    ): ShallowWrapper<C2['props'], C2['state'], C2>;
                    (props: EnzymePropSelector): ShallowWrapper<any, any, Component>;
                    (selector: string): ShallowWrapper<any, any, Component>;
                    };
                    • Find every node in the render tree that matches the provided selector.

                      Parameter selector

                      The selector to match.

                    method findWhere

                    findWhere: (
                    predicate: (wrapper: ShallowWrapper<any, any>) => boolean
                    ) => ShallowWrapper<any, any>;
                    • Finds every node in the render tree that returns true for the provided predicate function.

                    method hostNodes

                    hostNodes: () => ShallowWrapper<HTMLAttributes>;
                    • Strips out all the not host-nodes from the list of nodes

                      This method is useful if you want to check for the presence of host nodes (actually rendered HTML elements) ignoring the React nodes.

                    method parent

                    parent: () => ShallowWrapper<any, any>;
                    • Returns a wrapper with the direct parent of the node in the current wrapper.

                    method parents

                    parents: {
                    <P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
                    <P2>(component: ComponentType<P2>): ShallowWrapper<P2, any, Component>;
                    (selector: string): ShallowWrapper<any, any, Component>;
                    (props?: EnzymePropSelector): ShallowWrapper<any, any, Component>;
                    };
                    • Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.

                      Note: can only be called on a wrapper of a single node.

                    method renderProp

                    renderProp: <PropName extends keyof P>(
                    prop: PropName
                    ) => (...params: Parameters<P[PropName]>) => ShallowWrapper<any, never>;
                    • Returns a wrapper of the node rendered by the provided render prop.

                    method shallow

                    shallow: (options?: ShallowRendererProps) => ShallowWrapper<P, S>;

                      method unmount

                      unmount: () => this;

                        Interfaces

                        interface CommonWrapper

                        interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {}

                          property length

                          length: number;

                            method at

                            at: (index: number) => this;
                            • Returns a wrapper around the node at a given index of the current wrapper.

                            method contains

                            contains: (node: ReactElement | ReactElement[] | string | number) => boolean;
                            • Returns whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in.

                            method containsAllMatchingElements

                            containsAllMatchingElements: (
                            nodes: ReactElement[] | ReactElement[][]
                            ) => boolean;
                            • Returns whether or not all the given react elements exists in the shallow render tree

                            method containsAnyMatchingElements

                            containsAnyMatchingElements: (
                            nodes: ReactElement[] | ReactElement[][]
                            ) => boolean;
                            • Returns whether or not one of the given react elements exists in the shallow render tree.

                            method containsMatchingElement

                            containsMatchingElement: (node: ReactElement | ReactElement[]) => boolean;
                            • Returns whether or not a given react element exists in the shallow render tree.

                            method context

                            context: { (): any; <T>(key: string): T };
                            • Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.

                            method debug

                            debug: (options?: {
                            ignoreProps?: boolean | undefined;
                            verbose?: boolean | undefined;
                            }) => string;
                            • Returns an html-like string of the wrapper for debugging purposes. Useful to print out to the console when tests are not passing when you expect them to.

                            method equals

                            equals: (node: ReactElement) => boolean;
                            • Returns whether or not the current render tree is equal to the given node, based on the expected value.

                            method every

                            every: (selector: EnzymeSelector) => boolean;
                            • Returns whether or not all of the nodes in the wrapper match the provided selector.

                            method everyWhere

                            everyWhere: (fn: (wrapper: this) => boolean) => boolean;
                            • Returns whether or not all of the nodes in the wrapper pass the provided predicate function.

                            method exists

                            exists: (selector?: EnzymeSelector) => boolean;
                            • Returns whether or not the current node exists.

                            method filterWhere

                            filterWhere: (predicate: (wrapper: this) => boolean) => this;
                            • Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true.

                            method first

                            first: () => this;
                            • Reduce the set of matched nodes to the first in the set.

                            method forEach

                            forEach: (fn: (wrapper: this, index: number) => any) => this;
                            • Iterates through each node of the current wrapper and executes the provided function with a wrapper around the corresponding node passed in as the first argument.

                              Returns itself.

                              Parameter fn

                              A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first argument, and will be run with a context of the original instance.

                            method get

                            get: (index: number) => ReactElement;
                            • Returns the node at a given index of the current wrapper.

                            method getDOMNode

                            getDOMNode: <T extends Element = Element>() => T;
                            • Returns the outer most DOMComponent of the current wrapper.

                            method getElement

                            getElement: () => ReactElement;
                            • Returns the wrapper's underlying node.

                            method getElements

                            getElements: () => ReactElement[];
                            • Returns the wrapper's underlying node.

                            method getNode

                            getNode: () => ReactElement;
                            • Returns the wrapper's underlying node.

                            method getNodes

                            getNodes: () => ReactElement[];
                            • Returns the wrapper's underlying nodes.

                            method hasClass

                            hasClass: (className: string | RegExp) => boolean;
                            • Returns whether or not the current node has a className prop including the passed in class name.

                            method html

                            html: () => string;
                            • Returns a string of the rendered HTML markup of the current render tree.

                              Note: can only be called on a wrapper of a single node.

                            method instance

                            instance: () => C;
                            • Gets the instance of the component being rendered as the root node passed into shallow().

                              NOTE: can only be called on a wrapper instance that is also the root instance.

                            method invoke

                            invoke: <
                            K extends NonNullable<
                            {
                            [K in keyof P]-?: P[K] extends (...arg: any[]) => void ? K : never;
                            }[keyof P]
                            >
                            >(
                            invokePropName: K
                            ) => P[K];
                            • Invokes a function prop.

                              Parameter invokePropName

                              The function prop to call.

                              Parameter

                              ...args The arguments to the invokePropName function

                              Returns

                              The value of the function.

                            method is

                            is: (selector: EnzymeSelector) => boolean;
                            • Returns whether or not the current node matches a provided selector.

                            method isEmpty

                            isEmpty: () => boolean;
                            • Returns whether or not the current node is empty.

                              Deprecated

                              Use .exists() instead.

                            method isEmptyRender

                            isEmptyRender: () => boolean;
                            • Returns true if renderer returned null

                            method key

                            key: () => string;
                            • Returns the key value for the node of the current wrapper. NOTE: can only be called on a wrapper of a single node.

                            method last

                            last: () => this;
                            • Reduce the set of matched nodes to the last in the set.

                            method map

                            map: <V>(fn: (wrapper: this, index: number) => V) => V[];
                            • Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map function. Returns an array of the returned values from the mapping function..

                              Parameter fn

                              A mapping function to be run for every node in the collection, the results of which will be mapped to the returned array. Should expect a ShallowWrapper as the first argument, and will be run with a context of the original instance.

                            method matchesElement

                            matchesElement: (node: ReactElement) => boolean;
                            • Returns whether or not a given react element matches the shallow render tree.

                            method name

                            name: () => string;
                            • Returns the name of the current node of the wrapper.

                            method not

                            not: (selector: EnzymeSelector) => this;
                            • Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector. This method is effectively the negation or inverse of filter.

                            method prop

                            prop: { <K extends keyof P>(key: K): P[K]; <T>(key: string): T };
                            • Returns the prop value for the node of the current wrapper with the provided key.

                              NOTE: can only be called on a wrapper of a single node.

                            method props

                            props: () => P;
                            • Returns the props hash for the current node of the wrapper.

                              NOTE: can only be called on a wrapper of a single node.

                            method reduce

                            reduce: <R>(
                            fn: (prevVal: R, wrapper: this, index: number) => R,
                            initialValue?: R
                            ) => R;
                            • Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node is passed in as a ShallowWrapper, and is processed from left to right.

                            method reduceRight

                            reduceRight: <R>(
                            fn: (prevVal: R, wrapper: this, index: number) => R,
                            initialValue?: R
                            ) => R;
                            • Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node is passed in as a ShallowWrapper, and is processed from right to left.

                            method render

                            render: () => cheerio.Cheerio;
                            • Renders the component to static markup and returns a Cheerio wrapper around the result.

                            method setContext

                            setContext: (context: any) => this;
                            • A method that sets the context of the root component, and re-renders. Useful for when you are wanting to test how the component behaves over time with changing contexts. Returns itself.

                              NOTE: can only be called on a wrapper instance that is also the root instance.

                            method setProps

                            setProps: <K extends keyof P>(props: Pick<P, K>, callback?: () => void) => this;
                            • A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test how the component behaves over time with changing props. Calling this, for instance, will call the componentWillReceiveProps lifecycle method.

                              Similar to setState, this method accepts a props object and will merge it in with the already existing props. Returns itself.

                              NOTE: can only be called on a wrapper instance that is also the root instance.

                            method setState

                            setState: <K extends keyof S>(state: Pick<S, K>, callback?: () => void) => this;
                            • A method to invoke setState() on the root component instance similar to how you might in the definition of the component, and re-renders. This method is useful for testing your component in hard to achieve states, however should be used sparingly. If possible, you should utilize your component's external API in order to get it into whatever state you want to test, in order to be as accurate of a test as possible. This is not always practical, however. Returns itself.

                              NOTE: can only be called on a wrapper instance that is also the root instance.

                            method simulate

                            simulate: (event: string, ...args: any[]) => this;
                            • Simulate events. Returns itself.

                              Parameter args

                              ?

                            method simulateError

                            simulateError: (error: any) => this;
                            • Used to simulate throwing a rendering error. Pass an error to throw. Returns itself.

                              Parameter error

                            method slice

                            slice: (begin?: number, end?: number) => this;
                            • Returns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of Array#slice.

                            method some

                            some: (selector: EnzymeSelector) => boolean;
                            • Returns whether or not any of the nodes in the wrapper match the provided selector.

                            method someWhere

                            someWhere: (fn: (wrapper: this) => boolean) => boolean;
                            • Returns whether or not any of the nodes in the wrapper pass the provided predicate function.

                            method state

                            state: { (): S; <K extends keyof S>(key: K): S[K]; <T>(key: string): T };
                            • Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.

                            method tap

                            tap: (intercepter: Intercepter<this>) => this;
                            • Taps into the wrapper method chain. Helpful for debugging.

                            method text

                            text: () => string;
                            • Returns a string of the rendered text of the current render tree. This function should be looked at with skepticism if being used to test what the actual HTML output of the component will be. If that is what you would like to test, use enzyme's render function instead.

                              Note: can only be called on a wrapper of a single node.

                            method type

                            type: () => string | ComponentClass<P> | FunctionComponent<P>;
                            • Returns the type of the current node of this wrapper. If it's a composite component, this will be the component constructor. If it's native DOM node, it will be a string of the tag name.

                              Note: can only be called on a wrapper of a single node.

                            method update

                            update: () => this;
                            • Forces a re-render. Useful to run before checking the render output if something external may be updating the state of the component somewhere. Returns itself.

                              NOTE: can only be called on a wrapper instance that is also the root instance.

                            interface ComponentClass

                            interface ComponentClass<Props> {}

                              construct signature

                              new (props: Props, context?: any): Component<Props>;

                                interface EnzymePropSelector

                                interface EnzymePropSelector {}
                                • Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the following three categories:

                                  1. A Valid CSS Selector 2. A React Component Constructor 3. A React Component's displayName 4. A React Stateless component 5. A React component property map

                                index signature

                                [key: string]: any;

                                  interface Lifecycles

                                  interface Lifecycles {}

                                    property componentDidUpdate

                                    componentDidUpdate?:
                                    | {
                                    onSetState: boolean;
                                    prevContext: boolean;
                                    }
                                    | undefined;

                                      property getChildContext

                                      getChildContext?:
                                      | {
                                      calledByRenderer: boolean;
                                      [key: string]: any;
                                      }
                                      | undefined;

                                        property getDerivedStateFromProps

                                        getDerivedStateFromProps?:
                                        | { hasShouldComponentUpdateBug: boolean }
                                        | boolean
                                        | undefined;

                                          property setState

                                          setState?: any;

                                            index signature

                                            [lifecycleName: string]: any;

                                              interface MountRendererProps

                                              interface MountRendererProps {}

                                                property attachTo

                                                attachTo?: HTMLElement | null | undefined;
                                                • DOM Element to attach the component to

                                                property childContextTypes

                                                childContextTypes?: {} | undefined;
                                                • Merged contextTypes for all children of the wrapper

                                                property context

                                                context?: {} | undefined;
                                                • Context to be passed into the component

                                                property wrappingComponent

                                                wrappingComponent?: ComponentType<any> | undefined;
                                                • A component that will render as a parent of the node. It can be used to provide context to the node, among other things. See the [getWrappingComponent() docs](https://airbnb.io/enzyme/docs/api/ShallowWrapper/getWrappingComponent.html) for an example. **Note**: wrappingComponent must render its children.

                                                property wrappingComponentProps

                                                wrappingComponentProps?: {} | undefined;
                                                • Initial props to pass to the wrappingComponent if it is specified.

                                                interface ReactWrapper

                                                interface ReactWrapper<P = {}, S = {}, C = Component>
                                                extends CommonWrapper<P, S, C> {}

                                                  interface ShallowRendererProps

                                                  interface ShallowRendererProps {}

                                                    property adapter

                                                    adapter?: EnzymeAdapter | undefined;

                                                      property attachTo

                                                      attachTo?: any;

                                                        property context

                                                        context?: any;
                                                        • Context to be passed into the component

                                                        property disableLifecycleMethods

                                                        disableLifecycleMethods?: boolean | undefined;
                                                        • If set to true, componentDidMount is not called on the component, and componentDidUpdate is not called after setProps and setContext. Default to false.

                                                        property enableComponentDidUpdateOnSetState

                                                        enableComponentDidUpdateOnSetState?: boolean | undefined;
                                                        • The legacy enableComponentDidUpdateOnSetState option should be matched by lifecycles: { componentDidUpdate: { onSetState: true } }, for compatibility

                                                        property hydrateIn

                                                        hydrateIn?: any;

                                                          property lifecycleExperimental

                                                          lifecycleExperimental?: boolean | undefined;
                                                          • Enable experimental support for full react lifecycle methods

                                                          property lifecycles

                                                          lifecycles?: Lifecycles | undefined;

                                                            property PROVIDER_VALUES

                                                            PROVIDER_VALUES?: any;

                                                              property supportPrevContextArgumentOfComponentDidUpdate

                                                              supportPrevContextArgumentOfComponentDidUpdate?: boolean | undefined;
                                                              • the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by lifecycles: { componentDidUpdate: { prevContext: true } }, for compatibility

                                                              property suspenseFallback

                                                              suspenseFallback?: boolean | undefined;
                                                              • If set to true, when rendering Suspense enzyme will replace all the lazy components in children with fallback element prop. Otherwise it won't handle fallback of lazy component. Default to true. Note: not supported in React < 16.6.

                                                              property wrappingComponent

                                                              wrappingComponent?: ComponentType<any> | undefined;
                                                              • A component that will render as a parent of the node. It can be used to provide context to the node, among other things. See the [getWrappingComponent() docs](https://airbnb.io/enzyme/docs/api/ShallowWrapper/getWrappingComponent.html) for an example. **Note**: wrappingComponent must render its children.

                                                              property wrappingComponentProps

                                                              wrappingComponentProps?: {} | undefined;
                                                              • Initial props to pass to the wrappingComponent if it is specified.

                                                              interface ShallowWrapper

                                                              interface ShallowWrapper<P = {}, S = {}, C = Component>
                                                              extends CommonWrapper<P, S, C> {}

                                                                Type Aliases

                                                                type ComponentType

                                                                type ComponentType<Props> = ComponentClass<Props> | FunctionComponent<Props>;

                                                                  type EnzymeSelector

                                                                  type EnzymeSelector =
                                                                  | string
                                                                  | FunctionComponent<any>
                                                                  | ComponentClass<any>
                                                                  | EnzymePropSelector;

                                                                    type FunctionComponent

                                                                    type FunctionComponent<Props> = (props: Props, context?: any) => JSX.Element | null;

                                                                      type HTMLAttributes

                                                                      type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>;

                                                                        type Intercepter

                                                                        type Intercepter<T> = (intercepter: T) => void;

                                                                          type Parameters

                                                                          type Parameters<T> = T extends (...args: infer A) => any ? A : never;

                                                                            Package Files (1)

                                                                            Dependencies (2)

                                                                            Dev Dependencies (0)

                                                                            No dev dependencies.

                                                                            Peer Dependencies (0)

                                                                            No peer dependencies.

                                                                            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/@types/enzyme.

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