Skip to content
Discussion options

You must be logged in to vote

Interesting that it works with fetch. I suspect this is happening because of how jsdom implements Request, which we use before passing the input on to fetch. Can you try replacing fetch() with new Request() and see if that triggers the error you have been seeing?

If it does, then it means jsdom is not properly implementing Request, because it's supposed to use the base URL / location.origin if available.

As an aside, I would strongly recommend using Playwright instead of jsdom. It's a much more realistic test environment and still very fast and easy to set up.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants