New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MSW #68
Conversation
README.md
Outdated
ReactDom.render(<App />, document.getElementById("root")); | ||
}); | ||
``` | ||
|
||
### Fake XMLHTTPRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd frename that one Sinon, and the following fetchMock
type BaseRequest = { | ||
url?: string; | ||
method?: string; | ||
requestJson?: Record<string, any> | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what requestJson
means. Isn't it the body
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept the old code to avoid renaming too many things. You should remember! ;)
src/msw.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file name doesn't follow the same convention as other adapters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? There's only one other adapter which is named fetchMock
public/mockServiceWorker.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this file does here. It's included nowhere, and it looks autogenerated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Autogenerated by MSW installation instructions: https://mswjs.io/docs/integrations/browser
public/sinon.html
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you move this file to the example directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, that's we can handle it with vite to avoid bundling. I've not been able to make it work with sinon like I do with the two other adapters
Co-authored-by: Francois Zaninotto <francois@marmelab.com>
fetch-mock
,sinon
ormsw