I configure some tests using JSDom , where I need the global variables window and document , and also need to pass different URL / href for each test. How to set location.hash and location.href properties?
global.document = jsdom({url: 'http://localhost?something=not#test', 'html': ''}); global.window = document.defaultView; console.log(window.location.href); // returns 'about:blank' console.log(window.location.hash); // returns no value
I tried to assign values ββdirectly to window.location.hash with the same result.
source share