Cannot log after tests are done in jestjs

I was using the react-native default test case (see below) when Cannot log after tests are done happened.

it('renders correctly', () => {
  renderer.create(<App />);
});

Apparently, the problem was that the test ended but logging was still needed. So I tried to make the callback in the test case async, hoping that the test won’t terminate immediately:

it('renders correctly', async () => {
  renderer.create(<App />);
});

And it worked. However, I have very little clue what the inner working is.

Leave a Comment