Use the following examples to test setTimeout not pausing test:
1 2 3 4 5 6 7 | it('has working hooks', async () => { await new Promise(res => setTimeout(() => { console.log("Why don't I run?") expect(true).toBe(true) res() }, 15000)) } |
OR
1 2 3 4 5 6 7 | it('has working hooks', done => { setTimeout(() => { console.log("Why don't I run?") expect(true).toBe(true) done() }, 15000) } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.