In my case the problem was that in my source code I had code directly setting the href on the location object, like window.location.href=”https://stackoverflow.com/questions/29352578/somewhere”;
In my specs I set up a onbeforeunload listener that just returns a string instead of allowing the redirect to take place:
beforeAll(() => {
window.onbeforeunload = () => 'Oh no!';
});