title: Jest won't accept top-level-awaits with NodeJS16 & TypeScript
body: <p>I'm trying to update my NodeJS12 &amp; TypeScript app to Node16, one if the reasons is the need to use top-level-awaits.</p>
  <p>The code compiles correctly after the update, but Jest won't accept the specific top-level-await code:</p>
  <pre><code>ts-jest[ts-compiler] (WARN) src/xxx.ts:11:17 - error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
  
  11 const project = await client.getProjectId();
                     ~~~~~
   FAIL  src/xxx.test.ts
    ● Test suite failed to run
  
      Jest encountered an unexpected token
  </code></pre>
  <p>package.json:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;name&quot;: &quot;functions&quot;,
      &quot;scripts&quot;: {
          &quot;lint&quot;: &quot;eslint --ext .js,.ts .&quot;,
          &quot;lint:fix&quot;: &quot;eslint --ext .js,.ts . --fix&quot;,
          &quot;build&quot;: &quot;tsc -b&quot;,
          &quot;build:watch&quot;: &quot;tsc-watch&quot;,
          &quot;serve&quot;: &quot;...&quot;,
          &quot;test&quot;: &quot;env-cmd -f .env.json jest --runInBand --verbose&quot;
      },
      &quot;type&quot;: &quot;module&quot;,
      &quot;engines&quot;: {
          &quot;node&quot;: &quot;16&quot;
      },
      &quot;main&quot;: &quot;lib/index.js&quot;,
      &quot;exports&quot;: &quot;./lib/index.js&quot;,
      &quot;dependencies&quot;: {
          &quot;test&quot;: &quot;^1.0.0&quot;
      },
      &quot;devDependencies&quot;: {
          &quot;@google-cloud/functions-framework&quot;: &quot;^2.1.0&quot;,
          &quot;@types/busboy&quot;: &quot;^1.3.0&quot;,
          &quot;@types/compression&quot;: &quot;1.7.2&quot;,
          &quot;@types/cors&quot;: &quot;^2.8.12&quot;,
          &quot;@types/express&quot;: &quot;^4.17.12&quot;,
          &quot;@types/express-serve-static-core&quot;: &quot;^4.17.28&quot;,
          &quot;@types/google-libphonenumber&quot;: &quot;^7.4.23&quot;,
          &quot;@types/jest&quot;: &quot;^27.4.0&quot;,
          &quot;@types/jsonwebtoken&quot;: &quot;^8.5.7&quot;,
          &quot;@types/luxon&quot;: &quot;^2.0.9&quot;,
          &quot;@types/node-zendesk&quot;: &quot;^2.0.6&quot;,
          &quot;@types/sinon&quot;: &quot;^10.0.6&quot;,
          &quot;@types/supertest&quot;: &quot;^2.0.11&quot;,
          &quot;@types/swagger-ui-express&quot;: &quot;^4.1.3&quot;,
          &quot;@types/uuid&quot;: &quot;^8.3.4&quot;,
          &quot;@types/yamljs&quot;: &quot;^0.2.31&quot;,
          &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^5.9.0&quot;,
          &quot;@typescript-eslint/parser&quot;: &quot;^5.9.0&quot;,
          &quot;env-cmd&quot;: &quot;^10.1.0&quot;,
          &quot;eslint&quot;: &quot;^8.6.0&quot;,
          &quot;eslint-config-google&quot;: &quot;^0.14.0&quot;,
          &quot;eslint-config-prettier&quot;: &quot;^8.3.0&quot;,
          &quot;eslint-plugin-import&quot;: &quot;^2.25.4&quot;,
          &quot;eslint-plugin-prettier&quot;: &quot;^4.0.0&quot;,
          &quot;eslint-plugin-react-hooks&quot;: &quot;^4.2.1-beta-a65ceef37-20211130&quot;,
          &quot;jest&quot;: &quot;^27.4.7&quot;,
          &quot;prettier&quot;: &quot;^2.5.1&quot;,
          &quot;sinon&quot;: &quot;^12.0.1&quot;,
          &quot;supertest&quot;: &quot;^6.2.1&quot;,
          &quot;ts-jest&quot;: &quot;^27.1.3&quot;,
          &quot;ts-node&quot;: &quot;^10.4.0&quot;,
          &quot;tsc-watch&quot;: &quot;^4.6.0&quot;,
          &quot;typescript&quot;: &quot;^4.5.4&quot;
      },
      &quot;private&quot;: true
  }
  </code></pre>
  <p>tsconfig.json:</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      &quot;module&quot;: &quot;es2022&quot;,
      &quot;noImplicitReturns&quot;: true,
      &quot;noUnusedLocals&quot;: true,
      &quot;outDir&quot;: &quot;lib&quot;,
      &quot;sourceMap&quot;: false,
      &quot;strict&quot;: true,
      &quot;target&quot;: &quot;es2021&quot;,
      &quot;moduleResolution&quot;: &quot;Node&quot;,
      &quot;resolveJsonModule&quot;: true
    },
    &quot;compileOnSave&quot;: true,
    &quot;include&quot;: [
      &quot;src&quot;
    ],
    &quot;ts-node&quot;: {
      &quot;moduleTypes&quot;: {
        &quot;jest.config.ts&quot;: &quot;cjs&quot;
      }
    }
  }
  </code></pre>
  <p>jest.config.ts:</p>
  <pre><code>export default {
    roots: [
      '&lt;rootDir&gt;/src'
    ],
    setupFiles: ['./src/setupJestEnv.ts'],
    preset: 'ts-jest',
    testEnvironment: 'node',
    testPathIgnorePatterns: ['/node_modules/'],
    coverageDirectory: './coverage',
    coveragePathIgnorePatterns: ['node_modules', 'src/database', 'src/test', 'src/types'],
    globals: { 'ts-jest': { diagnostics: false } },
  };
  </code></pre>
  <p>I can't really understand what's wrong here. Any idea?</p>