Replies: 1 comment
-
Hi, @sjly3k. MSW performs the request handler lookup by iterating through the entire handlers list stored in memory. Since some handlers can be async and decide how to handle (or not handler) a request within the resolver, the iteration is sequential. Respectively, the more handlers you have, the potentially slower the request lookup gets. You never want to load all your handlers in every test. You gain nothing by that. In fact, you are complicating your testing setup and the debugging experience, if something goes wrong. What you should do is this:
Important Note that this doesn't affect how you organize your handler modules. You can certainly split them on a domain or service basis, improving the maintenance. I recommend you read the following: |
Beta Was this translation helpful? Give feedback.
-
Is there a significant performance difference between declaring only the necessary APIs and pre-declaring many APIs for convenience when testing?
Beta Was this translation helpful? Give feedback.
All reactions