Basic info:
- Node.js version: 18.12.0
- jsdom version: 21.0.0
Minimal reproduction case
We have a page that performs a redirect to an external page based on query string parameters:
...
<script>
const redirectUrl = 'https://github.com/'
window.location.href = redirectUrl;
// window.location.assign(redirectUrl);
</script>
...
and integration test that expects that location.href will be changed (or location.assing will be invoked with some params).
const windowLocation = {};
const { window } = new JSDOM(response.text, {
beforeParse(window) {
delete window.location;
window.location = windowLocation;
},
runScripts: 'dangerously',
});
expect(windowLocation.href).toBe('https://github.com/');
Previously (jsdom 20.0.3) we changed the original location object to a syntetic one and ran an expectation on it. But since window.location became non-configurable, it's no longer possible.
Any advice about options to spy on location object?
Right now, we are getting:
Error: Not implemented: navigation (except hash changes).
Thanks in advance!
Basic info:
Minimal reproduction case
We have a page that performs a redirect to an external page based on query string parameters:
and integration test that expects that
location.hrefwill be changed (orlocation.assingwill be invoked with some params).Previously (jsdom 20.0.3) we changed the original location object to a syntetic one and ran an expectation on it. But since
window.locationbecame non-configurable, it's no longer possible.Any advice about options to spy on location object?
Right now, we are getting:
Thanks in advance!