title: how to run jest test from multiple locations in VSCode
body: <p>I managed to mock typeorm to an extent but then now I'm facing a strange issue that I'll illustrate here.</p>
  
  <pre><code>import { myEntity } from './entity';
  import typeorm = require('typeorm');
  
  describe('test suire'), () =&gt; {
  
    let myRepository: typeorm.Repository&lt;myEntity&gt;;
  
    test('my test case', () =&gt; {
  
      typeorm.Repository = jest.fn().mockReturnValue({
        createQueryBuilder: jest.fn().mockReturnValue({
          where: jest.fn().mockReturnThis(),
          getMany: jest.fn().mockReturnValue([]);
        })
      });
  
      myRepository = new typeorm.Repository();
  
      expect(myRepository.createQueryBuilder).toHaveBeenCalledTimes(0);
  
    })
  })
  </code></pre>
  
  <p>I have a package structure like this:</p>
  
  <pre><code>root/
      package.json
      project1/
              package.json
              src/
                 the_above_test.spec.ts
  </code></pre>
  
  <p>When I run <code>node_modules/.bin/jest path_to_above_test.spec.ts</code> from <code>project1</code> it works. But when I run the same command from <code>root</code> I get:</p>
  
  <pre><code>Matcher error: received value must be a mock or spy function
  
  Received has value: undefined at line:
  
      expect(myRepository.createQueryBuilder).toHaveBeenCalledTimes(0);
  
  </code></pre>
  
  <p>The intention here is to debug the test from within VS Code. But since VS code is open at the root level, it executes the test from there. If there's no bug in my code, how can I tell VS Code to run the test from the <code>project1</code> directory?</p>