# All files / src index.ts

100% Statements 12/12
80% Branches 8/10
100% Functions 3/3
100% Lines 12/12

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
    29
    30
    31
    32
    33
    34

    32x

    31x

    31x
    344x
    344x

    31x

    31x
    31x
    31x
    31x

    31x
    31x

     import { cleanup } from './pure';
    import { flushMicroTasks } from './flushMicroTasks';
    import { getIsReactActEnvironment, setReactActEnvironment } from './act';

    if (typeof process === 'undefined' || !process.env?.RNTL_SKIP_AUTO_CLEANUP) {
      // If we're running in a test runner that supports afterEach
      // then we'll automatically run cleanup afterEach test
      // this ensures that tests run in isolation from each other
      // if you don't like this then either import the `pure` module
      // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.
      Eif (typeof afterEach === 'function') {
        // eslint-disable-next-line no-undef
        afterEach(async () => {
          await flushMicroTasks();
          cleanup();
        });
      }

      Eif (typeof beforeAll === 'function' && typeof afterAll === 'function') {
        // This matches the behavior of React < 18.
        let previousIsReactActEnvironment = getIsReactActEnvironment();
        beforeAll(() => {
          previousIsReactActEnvironment = getIsReactActEnvironment();
          setReactActEnvironment(true);
        });

        afterAll(() => {
          setReactActEnvironment(previousIsReactActEnvironment);
        });
      }
    }

    export * from './pure';