title: Jest spiedOn method is not called, but called once change the test case order
body: <ul>
  <li>The Spied on code is not called when the test is at the second position. (or a second <code>render</code>) and test case fails</li>
  <li>Test case passes if the test case is at the first position(or on first render).</li>
  </ul>
  
  <p>Using a very basic create-react-app OOTB example and simplifying it even more for a MCVE:</p>
  
  <p>MyModule.js</p>
  
  <pre><code>import React from 'react';
  import someClass from './someClass';
  
  function App() {
    someClass.track("someevent");
    return null;
  }
  
  export default App;
  </code></pre>
  
  <p>someClass.js</p>
  
  <pre><code>class SomeClass {
    constructor() {
      this.someProp = null;
    }
    getSatellite() {
        return {
          track: () =&gt; {}
        };
    }
    track(someProp) {
      ///THIS BELOW IF CLAUSE IS THE PROBLEM
      if (this.someProp === someProp) {
        return;
      } else {
        this.someProp = someProp;
      }
      ///////////////////////
      this.getSatellite().track('someevent');
    }
  }
  
  const instance = new SomeClass();
  
  export default instance;
  
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>import React from 'react';
  import MyModule from './MyModule'
  
  function App() {
    return (
      &lt;div className="App"&gt;
        &lt;MyModule /&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  
  <p>App.test.js</p>
  
  <pre><code>import React from 'react';
  import { render } from '@testing-library/react';
  import App from './App';
  import someClass from './someClass';
  
  test('renders learn react link', () =&gt; {
    render(&lt;App /&gt;);
  });
  
  // it works if this test case is first one, weird :-| 
  test('renders class', () =&gt; {
    const track = jest.fn();
    jest.spyOn(someClass, 'getSatellite').mockImplementation(()=&gt;{
      console.log('here i am');
      return {
        track
      }
    })
    render(&lt;App /&gt;);
    expect(track).toHaveBeenCalledTimes(1);
  });
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>  ✓ renders learn react link (17ms)
    ✕ renders class (5ms)
  
    ● renders class
  
      expect(jest.fn()).toHaveBeenCalledTimes(expected)
  
      Expected number of calls: 1
      Received number of calls: 0
  
        18 |   })
        19 |   render(&lt;App /&gt;);
      &gt; 20 |   expect(track).toHaveBeenCalledTimes(1);
           |                 ^
        21 | });
        22 | 
  
        at Object.&lt;anonymous&gt; (src/App.test.js:20:17)
  
  Test Suites: 1 failed, 1 total
  Tests:       1 failed, 1 passed, 2 total
  Snapshots:   0 total
  Time:        10.472s
  </code></pre>
  
  <p>Let me know if you need anything in the comments. </p>