supertest along with msw for mocks
See original GitHub issueEnvironment
Name | Version |
---|---|
msw | 0.19.5 |
node | 14.x |
OS | ubuntu |
node-request-interceptor@0.2.6 |
Request handlers
setupServer(
rest.post(process.env.ai_api_endpoint + '/datasync/job-profile/', (req, res, ctx) => {
/**
* here need to check actual response of ai api.
* but i think its just empty
*/
return res(ctx.status(200), ctx.json({}))
}),
)
await request(app)
.post("/user/login")
.set("Accept", "application/json")
.send({
"email": user.email,
"password": "123"
})
using msw with supertest causes empty post i.e data sent in “/user/login” is always empty. if i comment out the msw server, post json is not empty anymore
same problem as this https://github.com/mswjs/msw/issues/209#issuecomment-654427646
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Mock Service Worker adopts a brand-new request interception ...
The new algorithm is an internal change, so there are no breaking changes to the public API or behaviors of MSW in Node.js....
Read more >MSW logging warnings for unhandled Supertest requests
The request GET http://127.0.0.1:55984/api is one that Supertest is making to the app, which is the whole point of the test, not one...
Read more >Comparison with other tools - Mirage JS
MSW is a mocking library that can run in the browser or node. ... Mirage was built for testing and brings along concepts...
Read more >Node - Getting Started - Mock Service Worker Docs
One of the most common usages of Mock Service Worker in Node is utilizing our request handlers for integration tests. We are going...
Read more >React Testing Library - Mock Service Worker (msw) - YouTube
A tutorial on how to mock API calls with Mock Service Worker ( msw ) for writing tests. I'm using React Testing Library...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i can confirm the issues is fixed. it works for me now. thanks @kettanaito
The issue has been fixed in
node-request-interceptor
0.3.2
. The update on themsw
side will follow and be released in0.20.0
.