mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-01-31 09:01:01 -05:00
49 lines
2.4 KiB
JavaScript
49 lines
2.4 KiB
JavaScript
const nextJest = require('next/jest');
|
|
|
|
const createJestConfig = nextJest({
|
|
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
|
|
dir: './',
|
|
});
|
|
|
|
// Add any custom config to be passed to Jest
|
|
const customJestConfig = {
|
|
roots: ['<rootDir>/tests/jest'],
|
|
// Add more setup options before each test is run
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
|
|
moduleDirectories: ['node_modules', '<rootDir>/'],
|
|
testEnvironment: 'jest-environment-jsdom',
|
|
moduleNameMapper: {
|
|
// Handle module aliases (this will be automatically configured for you soon)
|
|
'^@/components/(.*)$': '<rootDir>/components/$1',
|
|
'^@/app/(.*)$': '<rootDir>/app/$1',
|
|
'^@/lib/(.*)$': '<rootDir>/lib/$1',
|
|
'^@/types/(.*)$': '<rootDir>/types/$1',
|
|
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',
|
|
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$': '<rootDir>/__mocks__/fileMock.js',
|
|
},
|
|
// Don't ignore node_modules by default
|
|
transformIgnorePatterns: [
|
|
'/node_modules/(?!(@upstash|@radix-ui|@hookform|@auth|@aws-sdk|@emotion|@mui|@prisma|@radix-ui|@react-email|@supabase|@types|@upstash|next-auth|react-markdown|rehype-raw|remark-gfm|uuid|react-syntax-highlighter)/)',
|
|
],
|
|
// Add more configuration options as needed
|
|
// 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'] }],
|
|
// },
|
|
// testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.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/(?!(react-syntax-highlighter|@heroicons|@aws-sdk|@radix-ui|@emotion|@mui|@prisma|@radix-ui|@react-email|@supabase|@types|@upstash|next-auth|react-markdown|rehype-raw|remark-gfm|uuid)/)',
|
|
// ],
|
|
};
|
|
|
|
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
|
module.exports = createJestConfig(customJestConfig);
|