Developing cross-environment JavaScript code often uncovers subtle gotchas and can cause pulsating headaches and endless frustration. While building a fetch wrapper designed to work consistently across browsers, Node and test environments, I ran into a surprising problem: Relative URLs worked fine in the browser but failed in JSDOM.
JSDOM is a JavaScript implementation of the DOM and web standards, allowing Node.js code to interact with a virtual browser environment. It’s widely used in testing frameworks like Jest and Vitest.
As a senior…








