"Cannot read property _location of null" when testing with Jest and react-testing-library

Hi,

I am encountering this issue intermittently but regularly when testing my NextJS React application using Jest and react-testing-library:

"Cannot read property _location of null"

This happens, I believe, because the Jest test process exits too quickly relative to what Apollo is doing, but I confess my understanding of this is a bit lacking.

I would appreciate any guidance on the issue and how I can resolve it! I can provide examples of my test setup if it would help.

Thank you

Hi @boileroo :wave: I don’t know enough to say what the issue might be, but your comment:

This happens, I believe, because the Jest test process exits too quickly relative to what Apollo is doing

Makes me wonder if you have some unresolved promises that you’re not awaiting in your test suite. Hope that helps!