# All files / src/helpers debugDeep.ts

100% Statements 5/5
66.66% Branches 4/6
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28

    10x

    10x

    10x

    2x

    8x

     import type { ReactTestRendererJSON } from 'react-test-renderer';
    import format, { FormatOptions } from './format';

    export type DebugOptions = {
      message?: string;
    } & FormatOptions;

    /**
     * Log pretty-printed deep test component instance
     */
    export default function debugDeep(
      instance: ReactTestRendererJSON | ReactTestRendererJSON[],
      options?: DebugOptions | string
    ) {
      const message = typeof options === 'string' ? options : options?.message;

      const formatOptions =
        typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;

      if (message) {
        // eslint-disable-next-line no-console
        console.log(`${message}\n\n`, format(instance, formatOptions));
      } else {
        // eslint-disable-next-line no-console
        console.log(format(instance, formatOptions));
      }
    }