jest doesn't wait beforeAll resolution to start tests
I found the solution. After trying almost anything, I didn't realize jest had a timeout setup which defaults at 5 seconds. So I increased this timeout and the tests now wait for the server promise to resolve.
I simply added jest.setTimeout(3 * 60 * 1000);
before the test suite.
In my case, it caused by the flaw of the beforeAll
part. Make sure the beforeAll
doesn't contain any uncaught exceptions, otherwise it will behaves that the testing started without waiting for beforeAll
resolves.