title: Cannot find module with Jest
body: <p>I have this class that I want to test with Jest in a nodeJS project</p>
  
  <pre><code>import moment from 'moment-timezone';
  
  export class DateUtil {       
  
      static toTimeZone(date: Date, tz: string): string {
          return moment(date).tz(tz).format();
      }    
  }
  </code></pre>
  
  <p>I've created this test:</p>
  
  <pre><code>import { DateUtil } from '../../src/util/date.util';
  
  
  describe('DateUtil', () =&gt; {
  ..
  </code></pre>
  
  <p>but when I run the test I got this error:</p>
  
  <pre><code>  ● Test suite failed to run
  
      Cannot find module 'moment-timezone' from 'date.util.ts'
  
        1 | import { Constants } from './constants';
      &gt; 2 | import moment from 'moment-timezone';
          | ^
        3 | 
        4 | 
        5 | export class DateUtil {
  </code></pre>
  
  <p>I have tried to use import in the test class</p>
  
  <pre><code>import moment from 'moment-timezone';
  </code></pre>
  
  <p>but then i have this problem</p>
  
  <pre><code>TS1259: Module '"C:/Users/sandro/IdeaProjects/bendiciones/node_modules/@types/moment-timezone/index"' can only be default-imported using the 'esModuleInterop' flag
  </code></pre>
  
  <p>and this is my <code>tsconfig.json</code> file where  esModuleInterop is set to true</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es6",
          "module": "commonjs",
          "lib": [
              "es6",
              "esnext"
          ],
          "declaration": true,
          "sourceMap": true,
          "outDir": "lib",
          "rootDir": "src",
          "removeComments": true,
          "strict": true,
          "noImplicitAny": true,
          "moduleResolution": "node",
          "strictNullChecks": true,
          "resolveJsonModule": true,
          "esModuleInterop": true,
          "experimentalDecorators": true,
          "emitDecoratorMetadata": true
      },
      "exclude": [
          "test"
      ]
  }
  </code></pre>
  
  <p>I also tried with this  <code>tsconfig.json</code> and with the same result</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es6",
          "module": "commonjs",
          "lib": [
              "es6",
              "esnext"
          ],
          "declaration": true,
          "sourceMap": true,
          "outDir": "lib",
          "rootDir": "src",
          "removeComments": true,
          "strict": true,
          "noImplicitAny": true,
          "moduleResolution": "node",
          "strictNullChecks": true,
          "resolveJsonModule": true,
          "esModuleInterop": true,
          "experimentalDecorators": true,
          "emitDecoratorMetadata": true
      }
  }
  </code></pre>
  
  <p>and this is how jtest is configured inside package.json</p>
  
  <pre><code>  "jest": {
          "transform": {
              "^.+\\.tsx?$": "ts-jest"
          },
          "testEnvironment": "node",
          "testRegex": "/test/.*\\.(test|it)\\.ts",
          "testPathIgnorePatterns": [
              "/coverage",
              "/lib"
          ],
          "moduleFileExtensions": [
              "ts",
              "tsx",
              "js",
              "jsx",
              "json",
              "node"
          ],
          "coverageThreshold": {
              "global": {
                  "branches": 80,
                  "functions": 80,
                  "lines": 80,
                  "statements": -20
              }
          },
          "collectCoverageFrom": [
              "src/**/*.ts",
              "!src/index.ts"
          ],
          "coverageReporters": [
              "json-summary",
              "text",
              "lcov"
          ]
      },
  </code></pre>