Files
metabuilder/frontends/workflowui/jest.config.cjs
2026-03-09 22:30:41 +00:00

50 lines
1.5 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 = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
// Handle module aliases
'^@/(.*)$': '<rootDir>/src/$1',
'^@metabuilder/fakemui$': '<rootDir>/__mocks__/fakeMuiMock.tsx',
'@/\\.\\./\\.\\./\\.\\./icons/react': '<rootDir>/__mocks__/iconsMock.tsx',
'@/\\.\\./\\.\\./\\.\\./scss/(.*)$': 'identity-obj-proxy',
// Fallback for icon mocks
'\\.(svg|png|jpg|jpeg|gif)$': '<rootDir>/__mocks__/fileMock.js',
// CSS modules
'\\.(css|scss|sass)$': 'identity-obj-proxy',
},
testMatch: [
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[jt]s?(x)',
],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{js,jsx,ts,tsx}',
'!src/**/_*.{js,jsx,ts,tsx}',
],
coveragePathIgnorePatterns: [
'/node_modules/',
'/.next/',
'/coverage/',
'/public/',
],
testPathIgnorePatterns: [
'/node_modules/',
'/.next/',
],
transformIgnorePatterns: [
'/node_modules/(?!(@metabuilder)/)',
],
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)