title: Jest reference error 'describe' is not defined when running Next.js build
body: <p>I am struggling to get a <code>next build</code> completing without the following error being thrown:</p>
  
  <pre><code>&gt; Build error occurred
  { ReferenceError: describe is not defined
  </code></pre>
  
  <p>The <code>dev</code> server and tests run fine but it does not seem to pick up the <code>jest</code> global <code>describe</code> in my <code>*.spec.tsx</code> files.</p>
  
  <p>I am using node version <code>10.16.1</code> with the following <code>package.json</code>:</p>
  
  <pre><code>{
      "name": "trufflus",
      "version": "0.1.0",
      "private": true,
      "scripts": {
          "dev": "next dev",
          "build": "next build",
          "start": "next start",
          "deploy": "npm run build &amp;&amp; next export",
          "test": "jest",
          "test:watch": "yarn test -- --watch",
          "lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
      },
      "husky": {
          "hooks": {
              "pre-commit": "lint-staged"
          }
      },
      "lint-staged": {
          "*.{js,ts,tsx}": [
              "eslint --fix"
          ]
      },
      "dependencies": {
          "next": "9.4.2",
          "react": "16.13.1",
          "react-dom": "16.13.1",
          "tailwindcss": "^1.4.6",
          "typeface-lobster": "^0.0.72",
          "typeface-roboto": "^0.0.75"
      },
      "devDependencies": {
          "autoprefixer": "^9.8.0",
          "postcss-import": "^12.0.1",
          "postcss-preset-env": "^6.7.0",
          "@testing-library/jest-dom": "^5.8.0",
          "@testing-library/react": "^10.0.4",
          "@types/jest": "^25.2.3",
          "@types/node": "^14.0.5",
          "@types/react": "^16.9.35",
          "@typescript-eslint/eslint-plugin": "^3.0.0",
          "@typescript-eslint/parser": "^3.0.0",
          "eslint": "^7.1.0",
          "eslint-config-prettier": "^6.11.0",
          "eslint-plugin-jest": "^23.13.1",
          "eslint-plugin-prettier": "^3.1.3",
          "eslint-plugin-react": "^7.20.0",
          "husky": "^4.2.5",
          "jest": "25.5.4",
          "lint-staged": "^10.2.6",
          "prettier": "^2.0.5",
          "prop-types": "^15.7.2",
          "ts-jest": "25.5.1",
          "typescript": "^3.9.3"
      }
  }
  </code></pre>
  
  <p>I have two seperate TypeScript configuration files; one for development/prod builds:</p>
  
  <pre><code>{
      "compilerOptions": {
          "target": "es5",
          "lib": ["dom", "dom.iterable", "esnext"],
          "allowJs": true,
          "skipLibCheck": true,
          "strict": false,
          "forceConsistentCasingInFileNames": true,
          "noEmit": true,
          "esModuleInterop": true,
          "module": "esnext",
          "moduleResolution": "node",
          "resolveJsonModule": true,
          "isolatedModules": true,
          "jsx": "preserve"
      },
      "exclude": ["node_modules"],
      "include": ["next-env.d.ts", "node_modules/@types", "**/*.ts", "**/*.tsx"]
  </code></pre>
  
  <p>And one for testing:</p>
  
  <pre><code>{
      "extends": "./tsconfig.json",
      "compilerOptions": {
          "jsx": "react",
          "types": ["jest", "node"]
      },
      "exclude": ["**/*.spec.tsx"]
  }
  </code></pre>
  
  <p>I have separate <code>components</code> and <code>pages</code> folders which both contain <code>*.spec.tsx</code> files.</p>
  
  <p>I have tried upgrading my version of Node and according to this issue:</p>
  
  <p><a href="https://stackoverflow.com/questions/59927799/referenceerror-describe-is-not-defined-in-jest-typescript">ReferenceError: describe is not defined in Jest + Typescript</a></p>
  
  <p>My configuration above should work but I do not know where this is now failing.</p>
  
  <p>I have tried upgrading <code>jest</code>, <code>ts-jest</code> and <code>node</code> to no avail!</p>