title: Importing local files in `jest.config.js` file
body: <p>In my <code>jest.config.js</code> file, I need to populate <code>globals</code> property. For populating the <code>globals</code> property I need to require local modules, as shown below:</p>
  
  <pre><code>const path = require('path')
  const server = require('./server/cfg')
  
  module.exports = {
      rootDir: path.resolve(__dirname),
      moduleFileExtensions: [
          'js',
          'json',
          'vue',
          'ts'
      ],
      moduleNameMapper: {
          '^@/(.*)$': '&lt;rootDir&gt;/src/$1'
      },
      transform: {
          ".*\\.(vue)$": "&lt;rootDir&gt;/node_modules/vue-jest",
          "^.+\\.(js|jsx)?$": "&lt;rootDir&gt;/node_modules/babel-jest",
          "^.+\\.ts$": "&lt;rootDir&gt;/node_modules/ts-jest"
      },
      testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
      snapshotSerializers: [
          "jest-serializer-vue"
      ],
      setupFiles: [
        "&lt;rootDir&gt;/globals.js"
      ],
      testEnvironment: "jsdom",
      globals: {
          server: {
              server
          }
      }
  }
  </code></pre>
  
  <p>Whit this configuration, I get the following error: </p>
  
  <p><code>Error: Cannot find module './server/cfg'</code></p>
  
  <p>This is my folder structure</p>
  
  <pre><code>server/
     cfg.ts
  src/
  jest.config.js
  webpack.config.js
  </code></pre>
  
  <p>However, I can <code>require</code> node's built-in modules. I'm not able to figure out why it is happening. Any ideas on how I can overcome this?</p>