Skip to content
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

Merged
merged 7 commits into from May 13, 2024
Merged

Add support for MSW #68

merged 7 commits into from May 13, 2024

Conversation

djhi
Copy link
Contributor

@djhi djhi commented May 3, 2024

  • Add support for MSW
  • Allow running the example with either fetch-mock, sinon or msw
  • Fix tests

@djhi djhi added RFR Ready For Review WIP Work In Progress and removed RFR Ready For Review labels May 3, 2024
@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels May 3, 2024
@djhi djhi mentioned this pull request May 3, 2024
2 tasks
@djhi djhi added this to the 4.0.0 milestone May 3, 2024
README.md Outdated
ReactDom.render(<App />, document.getElementById("root"));
});
```

### Fake XMLHTTPRequest
Copy link
Member

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

README.md Outdated Show resolved Hide resolved
type BaseRequest = {
url?: string;
method?: string;
requestJson?: Record<string, any> | undefined;
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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?

Copy link
Contributor Author

@djhi djhi May 4, 2024

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

djhi and others added 2 commits May 4, 2024 12:58
Co-authored-by: Francois Zaninotto <francois@marmelab.com>
@fzaninotto fzaninotto merged commit 795e8f8 into master May 13, 2024
3 checks passed
@fzaninotto fzaninotto deleted the msw branch May 13, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants