jest.config.ts 703 B

123456789101112131415161718192021
  1. import type { Config } from "jest";
  2. import nextJest from "next/jest.js";
  3. const createJestConfig = nextJest({
  4. // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
  5. dir: "./",
  6. });
  7. // Add any custom config to be passed to Jest
  8. const config: Config = {
  9. coverageProvider: "v8",
  10. testEnvironment: "jsdom",
  11. testMatch: ["**/*.test.js", "**/*.test.ts", "**/*.test.jsx", "**/*.test.tsx"],
  12. setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
  13. moduleNameMapper: {
  14. "^@/(.*)$": "<rootDir>/$1",
  15. },
  16. };
  17. // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
  18. export default createJestConfig(config);