@types/react-test-renderer

  • Version 18.3.0
  • Published
  • 8.42 kB
  • 1 dependency
  • MIT license

Install

npm i @types/react-test-renderer
yarn add @types/react-test-renderer
pnpm add @types/react-test-renderer

Overview

TypeScript definitions for react-test-renderer

Index

Variables

variable UNDEFINED_VOID_ONLY

const UNDEFINED_VOID_ONLY: Symbol;

    Functions

    function act

    act: {
    (callback: () => Promise<VoidOrUndefinedOnly>): Promise<undefined>;
    (callback: () => VoidOrUndefinedOnly): DebugPromiseLike;
    };
    • Wrap any code rendering and triggering updates to your components into act() calls.

      Ensures that the behavior in your tests matches what happens in the browser more closely by executing pending useEffects before returning. This also reduces the amount of re-renders done.

      Parameter callback

      An asynchronous, void callback that will execute as a single, complete React commit.

      See Also

      • https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks

      Deprecated

      See https://react.dev/warnings/react-test-renderer

    • Wrap any code rendering and triggering updates to your components into act() calls.

      Ensures that the behavior in your tests matches what happens in the browser more closely by executing pending useEffects before returning. This also reduces the amount of re-renders done.

      Parameter callback

      A synchronous, void callback that will execute as a single, complete React commit.

      See Also

      • https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks

      Deprecated

      See https://react.dev/warnings/react-test-renderer

    function create

    create: (
    nextElement: ReactElement,
    options?: TestRendererOptions
    ) => ReactTestRenderer;
    • Deprecated

      See https://react.dev/warnings/react-test-renderer

    Interfaces

    interface DebugPromiseLike

    interface DebugPromiseLike {}

      method then

      then: (
      onfulfilled: (value: never) => never,
      onrejected: (reason: never) => never
      ) => never;

        interface ReactTestInstance

        interface ReactTestInstance {}

          property children

          children: Array<ReactTestInstance | string>;

            property instance

            instance: any;

              property parent

              parent: null | ReactTestInstance;

                property props

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

                  property type

                  type: ElementType;

                    method find

                    find: (predicate: (node: ReactTestInstance) => boolean) => ReactTestInstance;

                      method findAll

                      findAll: (
                      predicate: (node: ReactTestInstance) => boolean,
                      options?: { deep: boolean }
                      ) => ReactTestInstance[];

                        method findAllByProps

                        findAllByProps: (
                        props: { [propName: string]: any },
                        options?: { deep: boolean }
                        ) => ReactTestInstance[];

                          method findAllByType

                          findAllByType: (
                          type: ElementType,
                          options?: { deep: boolean }
                          ) => ReactTestInstance[];

                            method findByProps

                            findByProps: (props: { [propName: string]: any }) => ReactTestInstance;

                              method findByType

                              findByType: (type: ElementType) => ReactTestInstance;

                                interface ReactTestRenderer

                                interface ReactTestRenderer {}

                                  property root

                                  root: ReactTestInstance;

                                    method getInstance

                                    getInstance: () => null | ReactTestInstance;

                                      method toJSON

                                      toJSON: () => null | ReactTestRendererJSON | ReactTestRendererJSON[];

                                        method toTree

                                        toTree: () => null | ReactTestRendererTree;

                                          method unmount

                                          unmount: (nextElement?: ReactElement) => void;

                                            method update

                                            update: (nextElement: ReactElement) => void;

                                              interface ReactTestRendererJSON

                                              interface ReactTestRendererJSON {}

                                                property children

                                                children: null | ReactTestRendererNode[];

                                                  property props

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

                                                    property type

                                                    type: string;

                                                      interface ReactTestRendererTree

                                                      interface ReactTestRendererTree extends ReactTestRendererJSON {}

                                                        property instance

                                                        instance: any;

                                                          property nodeType

                                                          nodeType: 'component' | 'host';

                                                            property rendered

                                                            rendered: null | ReactTestRendererTree | ReactTestRendererTree[];

                                                              interface TestRendererOptions

                                                              interface TestRendererOptions {}

                                                                method createNodeMock

                                                                createNodeMock: (element: ReactElement) => any;

                                                                  Type Aliases

                                                                  type ReactTestRendererNode

                                                                  type ReactTestRendererNode = ReactTestRendererJSON | string;

                                                                    Package Files (1)

                                                                    Dependencies (1)

                                                                    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/react-test-renderer.

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