jest.config.js 680 B

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