JavaScript の window.location は read-only プロパティなので上書きできず、したがって Sinon.JS でスタブすることもできない。知らなかった。 Window.location - Web API Interfaces | MDN The Window.location read-only property returns a Location object with information about the current location of the document. Mocha とかを使ってブラウザでテストを走らせる場合、 window.location.reload() とかが実行されるコードパスを通ると test.html 的なページが延々リフレッシュされ、永遠にテストが終わらない。 そういう場合は window.location.r