I would like to add (this is a bit long for a comment) that even with a timeout of 3000
my tests would still sometimes (randomly) fail with
Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
Thanks to Tarun's great answer, I think the shortest way to fix a lot of tests is:
describe('puppeteer tests', () => {
beforeEach(() => {
jest.setTimeout(10000);
});
test('best jest test fest', async () => {
// Blah
});
});