작성
·
420
0
답변 2
0
0
안녕하세요 !!!!
질문 전혀 이상하지 않고 사실 저도 많이 고민했던 부분입니다 !
왜냐면 처음에는 저도 브라우저 통합으로 구현했었거든요 !!!
근데 결국 Jest 사용을 위해서 노드 통합으로 바꾸었습니다 !
사실 MSW 사이트에 설명을 보면 이 부분이 너무 짧게 나와있습니다...
The same request handlers can be shared between browser and Node environments.
Since Service Workers cannot run in Node, the integration process is different depending on the environment.
BROWER 통합
Mock Service Worker operates client-side by registering a Service Worker responsible for requests interception. However, we don't have to write any of the worker's code by ourselves, but rather copy the worker file distributed by the library. Mock Service Worker provides a dedicated CLI to help us do that.
NODE 통합
One of the most common usages of Mock Service Worker in Node is utilizing our request handlers for integration tests. We are going to use Jest as a test runner. Following the same principle, you can integrate mocking into any Node process.
Jest를 사용하지 않으시고 테스트를 진행하시려면 Browser 통합으로 가주시면 될 것 같고 Jest를 사용하시려면 Node 통합으로 하시면 될 것 같습니다 !!!
질문 많이 해주세요 감사합니다 !!!