andywer / leakage

🐛 Memory leak testing for node.
1.58k stars 52 forks source link

question with mocha test , how can i detect `iterate` was done ? #17

Closed tommyZZM closed 7 years ago

tommyZZM commented 7 years ago
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

how can i detect iterate was done ?

andywer commented 7 years ago

Hi, @tommyZZM.

The error message means that the test took too much time to run, so mocha cancelled it. You can simply solve the problem by increasing the timeout: Run mocha with --timeout 5000 to increase the timeout to 5000ms (5s), for instance.

Maybe the code you are testing takes quite long to run. You can also decrease the iteration count (the first parameter you pass to iterate). If you iterate 100 times like in the sample then try to decrease it to 30, for instance.

I will add a timeout section to the README for future use :)

andywer commented 7 years ago

Just added a "You might want to know" section to the README, also containing tips how to deal with timeout errors like I wrote to you here.

If you find some time, tell me if that helps 😉