title: Jest: How to get arguments passed to mock constructor?
body: <p>If I want to create a mock implementation of an instance method of an ES6 Class I would do this</p>
  
  <pre><code>// ExampleClass.js
  export class ExampleClass {
      constructor(someValue) {
          this.a = someValue;
      }
  
      exampleMethod(anotherValue) {
          // do something with 'anotherValue'
      }
  }
  
  // OtherModule.js
  import {ExampleClass} from './ExampleClass';
  export const fooBar = () =&gt; {
      const ex = new ExampleClass("hello world");
      ex.exampleMethod("another value");
  };
  
  // ExampleClass.test.js
  import {fooBar} from './OtherModule';
  import {ExampleClass} from './ExampleClass';
  jest.mock('./ExampleClass');
  
  it('try to create a mock of ExampleClass', () =&gt; {
      ExampleClass.mockClear();
  
      fooBar();
  
      // to verify values for of instance method "exampleMethod" of ExampleClass instance
      expect(ExampleClass.mock.instances[0].exampleMethod.calls.length).toBe(1);
      expect(ExampleClass.mock.instances[0].exampleMethod.calls[0][0]).toBe("another value");
  
      // How to verify values for **constructor** of ExampleClass ?????
      // expect(ExampleClass.mock.instances[0].constructor.calls.length).toBe(1);
      // expect(ExampleClass.mock.instances[0].constructor.calls[0][0]).toBe("another value");
  });
  </code></pre>
  
  <p>What I don't know how to do (and sort of alluded to in the commented code) is how to spy on / access the values of the constructor (not just an instance method).</p>
  
  <p>Any help would be greatly appreciated! ❤</p>