Skip to content

Document hard-coded implicit delay in Node.js #376

Answered by kettanaito
jlissner asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @jlissner. Thanks for bringing this up.

Yes, that's indeed an implicit feature designed to provide a better testing experience since in the light of how the realistic server response time is used with the delay() function.

MSW intends that use case to enable server-like response times when developing, but when testing you want your network to be fast. That's why we preemptively hard-code the realistic response time to a fixed value when run in Node.js. Your tests should be reliable and reproducible, which means a reliable and reproducible network that MSW aims to provide, including the fixed response timing when using the delay() function without any arguments.

You can opt-out from th…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jlissner
Comment options

Answer selected by jlissner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants