module.exports = { collectCoverage: true, coverageProvider: 'v8', collectCoverageFrom: [ '**/*.{js,jsx,ts,tsx}', '!**/*.d.ts', '!**/node_modules/**', '!/out/**', '!/.next/**', '!/*.config.js', '!/coverage/**', '!/src/types/**', '!/src/utils/charting_library/**', '!/src/utils/datafeeds/**', '!/public/charting_library/**', '!/public/datafeeds/**', '!/src/utils/health_computer/**', ], moduleNameMapper: { // Handle CSS imports (with CSS modules) // https://jestjs.io/docs/webpack#mocking-css-modules '^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy', // Handle CSS imports (without CSS modules) '^.+\\.(css|sass|scss)$': '/__mocks__/styleMock.js', // Handle image imports // https://jestjs.io/docs/webpack#handling-static-assets '^.+\\.(png|jpg|jpeg|gif|webp|avif|ico|bmp)$/i': `/__mocks__/fileMock.js`, '^.+\\.svg$': `/__mocks__/svgMock.js`, // Handle module aliases '^app/(.*)$': '/src/app/$1', '^api/(.*)$': '/src/api/$1', '^components/(.*)$': '/src/components/$1', '^constants/(.*)$': '/src/constants/$1', '^fonts/(.*)$': '/src/fonts/$1', '^hooks/(.*)$': '/src/hooks/$1', '^pages/(.*)$': '/src/pages/$1', '^store/(.*)$': '/src/store/$1', '^styles/(.*)$': '/src/styles/$1', '^types/(.*)$': '/src/types/$1', '^utils/(.*)$': '/src/utils/$1', '^store': '/src/store', }, // Add more setup options before each test is run setupFilesAfterEnv: [ '/jest.setup.js', '/__mocks__/store.js', '/__mocks__/helmet.js', ], testPathIgnorePatterns: ['/node_modules/', '/.next/'], testEnvironment: 'jsdom', transform: { // Use babel-jest to transpile tests with the next/babel preset // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }], }, transformIgnorePatterns: ['/node_modules/', '^.+\\.module\\.(css|sass|scss)$'], }