-
Notifications
You must be signed in to change notification settings - Fork 334
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
test: describe network using only msw #711
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
this here fixes some incompatabilities with using happy-dom
. Somewhere some serialization is failing which results in a new URL("[object Request]")
which (obviously) fails. this patch seems to fix it
} | ||
this.logger.info("no mocked response received!"); | ||
- return pureFetch(request).then((response) => { | ||
+ return pureFetch(resolvedInput, init).then((response) => { |
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.
Interesting. The request
is created by taking init
into account:
Can you tell me more about how you reproduce this issue? Would love to make a regression test out of it.
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.
Something with happy-dom when it's creating the url object for the request. seems like something doesn't get serialized as i debugged it was calling the URL constructor with the string [object Request]
resulting in a Invalid URL
error
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.
Looks much better now! Great job, @juliusmarminge. I've left a few comments on how you can improve MSW usage even further. Give those a read.
Co-authored-by: Artem Zakharchenko <[email protected]>
Co-authored-by: Artem Zakharchenko <[email protected]>
Co-authored-by: Artem Zakharchenko <[email protected]>
🚀 |
trying to get rid of our
mockExternalRequest(db)
in favor of only using msw to describe all the external requests, no matter if the method accepts a fetch override or not.it's going.... well not so good 😓