I'm testing my tyscript code on nodejs and would like to test a function which is expected to be timeout error.
I've used should().rejected and something else but I have no idea how to test timeout error
. Even in the official document , nothing about that.
How can I test that?
I've tried like should.rejected.
Use fake timers from sinon.js . With clock.tick(ms)
you can simulate a time and then catch your timeout error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.