title: jest.doMock and JSON import mocking
body: <p>I have such code to test:</p>
  <pre><code>...
  import data from '../data/mock.json';
  
  // function is async
  export const something = async () =&gt; {
      try {
          ...
          if (!data) {
            throw 'error is here!';
          }
  
          return data;
      } catch (error) {
          return error;
      }
  };
  </code></pre>
  <p>and my spec looks so:</p>
  <pre><code>...
  import { something } from './handler';
  
  describe('handler: something', () =&gt; {
      beforeEach(() =&gt; {
          jest.resetModules();
      });
  
      describe('on something', () =&gt; {
          it('should return data', async () =&gt; {
              const data = [
                  {
                      id: 1,
                      price: '1',
                  },
                  {
                      id: 2,
                      price: '2',
                  },
              ];
  
              jest.doMock('../data/mock.json', () =&gt; {
                  return {
                      __esModule: true,
                      default: data,
                  };
              });
              await import('../data/mock.json');
  
              await expect(something()).resolves.toEqual(data);
          });
  
          it('should return error', async () =&gt; {
              jest.doMock('../data/mock.json', () =&gt; ({
                  __esModule: true,
                  default: undefined,
              }));
  
              await import('../data/mock.json');
  
              await expect(something()).resolves.toBe('error is here');
          });
      });
  });
  </code></pre>
  <p>not sure why: but it doesn't mock json import inside my code, that I wish to test. What I do wrong and how to make this import mocked 'conditionally'? because if I mock it at the top of the file (nearby imports) - it will work but will be the same for all test cases while I need to make this data different in different test cases.</p>