Make Node a browser-like environment, by using Happy DOM.
npm install --save happy-dom-global
Simply importing it will register browser-like globals:
import 'happy-dom-global';
console.log ( typeof globalThis.window ); // => 'object'
console.log ( typeof globalThis.document ); // => 'object'
console.log ( typeof globalThis.location ); // => 'object'
MIT © Fabio Spampinato