jest.config.mjs 647 B

12345678910111213141516171819
  1. import nextJest from 'next/jest.js'
  2. const createJestConfig = nextJest({
  3. // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
  4. dir: './',
  5. })
  6. // Add any custom config to be passed to Jest
  7. /** @type {import('jest').Config} */
  8. const config = {
  9. // Add more setup options before each test is run
  10. // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  11. testEnvironment: 'jest-environment-jsdom',
  12. setupFilesAfterEnv: ['./jest.setup.mjs'],
  13. }
  14. // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
  15. export default createJestConfig(config)