title: reset typescript singleton instance in each unit test
body: <p>I have a typescript singleton class like so:</p>
  <pre class="lang-js prettyprint-override"><code>export default class MySingleton {
  private constructor({
      prop1,
      prop2,
      ...
    }: MySingletonConfig) {
      
      this.prop1 = prop1 ?? 'defaultProp1';
      this.prop2 = prop2;
      this.prop3 = prop3 ?? 'defaultProp3';
  
      /* ... some instruction ... */
  
      MySingleton.instance = this;
    }
  
    static getInstance(params?: Configuration): MySingleton {
      if (!this.instance &amp;&amp; !params) {
        throw MySingleton.instantiationError;
      }
  
      if (!this.instance) {
        new MySingleton(params);
  
        return this.instance;
      }
  
      return this.instance;
    }
  }
  </code></pre>
  <p>When I want to unit test it using jest, like so:</p>
  <pre class="lang-js prettyprint-override"><code>describe('getInstance()', () =&gt; {
      test('it should return the same instance every time', () =&gt; {
        const params = {
         /* ... all the params ... */
        };
  
       
        const mySingleton = MySingleton.getInstance(params);
  
        expect(MySingleton.getInstance()).toEqual(mySingleton);
      });
      test('it should return the instance with the default value', () =&gt; {
        const params = {
         /* ... ONLY THE REQUIRED PARAMS ... */
        };
       
        const mySingleton = MySingleton.getInstance(params);
  
        expect(mySingleton.prop1).toEqual('defaultProp1');
        expect(mySingleton.prop3).toEqual('defaultProp3');
      });
    });
  </code></pre>
  <p>This is failing, because we share the same instance between the  2 tests (as the singleton pattern work), therefore the second instantiation is useless.</p>
  <p>Is there a way to reset/destroy the previous instantiation in order to properly check if those default values are properly setted with the second intantiation?</p>