Testing · Middle · Question 17 of 75
Why is MSW often preferred over mocking fetch/axios directly?
- ✓Correct answer: Tests don't depend on which HTTP client is used, and the real request code (URLs, headers, parsing) is exercised
- 2MSW is faster than any mock
- 3Mocking
fetchis not possible in Node.js
Explanation
Switching from axios to fetch doesn't break tests that mock at the network level.