Angular + Mocha memory leak

后端 未结 3 1831
失恋的感觉
失恋的感觉 2021-01-13 08:49

I\'m getting the following error when running the entire suite of tests:

timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 09:15

    I don't see you cleaning up your mocked http backend. I have no idea how it functions, but I would expect that all your requests and responses are being stored in memory. That would cause it to increase gradually, test by test.

    If this was using Sinon I would expect that you would create a stub/spy before the tests and clean it up afterwards (or run it in a sandbox).

    Try taking a heap snapshot before and after running a test and diff the snapshots to find which objects keep increasing in numbers.

提交回复
热议问题