jest test is not exiting after test passes with react-test-renderer

Viewed 15

I have a toMatchSnapshot test on a simple component with React Native 0.68.2/jest 29.0. Here is the component SysError:

import React, {useState, useContext, Component} from 'react';
import {Platform, Button, Text, TouchableOpacity } from 'react-native';

export default function SysError({route}) {
    const message = route.params.message;
    return (
        <Text>{message}. System NOT available right now. Try again later</Text>
    )
};

Here is the SysError.test.js:

import React from 'react';
import renderer from 'react-test-renderer';  //<<==v17.0.2
import SysError from './SysError';

it ('describe SysError page view with no message', () => {
    const route = {params: {message:"noth"}};
    const tree = renderer.create(<SysError route={route} />).toJSON();
    expect(tree).toMatchSnapshot();
})

After yarn test --detectOpenHandle, test passes but is not exiting by itself. Here is the error for component SysError:

  Jest has detected the following 2 open handles potentially keeping Jest from exiting:

  ●  MESSAGEPORT

      1 | import React from 'react';
    > 2 | import renderer from 'react-test-renderer';
        | ^
      3 | import SysError from './SysError';
      4 |
      5 | it ('describe SysError page view with no message', () => {

      at node_modules/scheduler/cjs/scheduler.development.js:178:17
      at Object.<anonymous> (node_modules/scheduler/cjs/scheduler.development.js:13:3)
      at Object.require (node_modules/scheduler/index.js:6:20)
      at require (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:19:19)
      at Object.<anonymous> (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13:3)
      at Object.require (node_modules/react-test-renderer/index.js:6:20)
      at Object.<anonymous> (src/components/app/SysError.test.js:2:1)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

There is no async call in SysError.js and what is missing here?

0 Answers
Related