jest.config.js 739 B

1234567891011121314151617181920
  1. /* eslint-disable @typescript-eslint/no-require-imports */
  2. const nextJest = require("next/jest");
  3. const createJestConfig = nextJest({
  4. // Provide the path to your Next.js app to load next.config.js and .env files
  5. dir: "./"
  6. });
  7. // Add any custom config to be passed to Jest
  8. const customJestConfig = {
  9. setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
  10. moduleNameMapper: {
  11. // Handle module aliases (this will be automatically configured for you based on your tsconfig.json paths)
  12. "^@/(.*)$": "<rootDir>/src/$1"
  13. },
  14. testEnvironment: "jest-environment-jsdom"
  15. };
  16. // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
  17. module.exports = createJestConfig(customJestConfig);