title: Multiple Sinon stubs against global window not working as expected
body: <p>I'm using Karma with Mocha, Chai and Sinon to test code in a project using <a href="https://github.com/ufocoder/redux-universal-boilerplate" rel="nofollow noreferrer">this boilerplate</a>. The Subject Under Test uses the <a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis" rel="nofollow noreferrer">Speech Synthesis</a> API.</p>
  
  <p>I start by establishing <code>window.speechSynthesis.getVoices</code> in a <code>beforeEach</code> method</p>
  
  <pre><code>beforeEach(() =&gt; {
      global.window.speechSynthesis = {
          getVoices: () =&gt; (null),
      };
  });
  </code></pre>
  
  <p>Then I have two test cases, in each one, I want to test what happens when a different set of voices is returned. To accomplish this I'm using <a href="http://sinonjs.org/releases/v3.3.0/stubs/" rel="nofollow noreferrer">Sinon stubs</a></p>
  
  <p><strong>First test case</strong></p>
  
  <pre><code>it('supports speech and locale', () =&gt; {
      const getVoicesStub = sinon.stub(
          global.window.speechSynthesis,
          'getVoices');
  
      getVoicesStub.callsFake(() =&gt; (
          [{lang: 'en_US'}]
      ));
  </code></pre>
  
  <p><strong>Second test case</strong></p>
  
  <pre><code>it('will choose best matching locale', () =&gt; {
      const getVoicesStub = sinon.stub(
          global.window.speechSynthesis,
          'getVoices');
  
      getVoicesStub.callsFake(() =&gt; (
          [{lang: 'es_MX'}, {lang: 'es_US'}]
      ));
  </code></pre>
  
  <p>The problem is, when the SUT calls <code>window.speechSynthesis.getVoices</code> during the second test case, it's getting the results from the first stub. It's as if the second stub is doing nothing...</p>
  
  <p>If I comment out the first test case, the second test case succeeds, but if I leave them both in, the second one fails because the wrong set of voices are being returned.</p>
  
  <p>Any idea how to get the second stub to work as expected?</p>