2023-04-20 11:21:21 -05:00
|
|
|
import type { Config } from '@jest/types';
|
2022-02-19 02:14:23 -05:00
|
|
|
|
2022-11-22 03:47:17 -05:00
|
|
|
const config: Config.InitialOptions = {
|
2023-04-20 11:21:21 -05:00
|
|
|
roots: ['<rootDir>/src'],
|
|
|
|
testEnvironment: 'jsdom',
|
|
|
|
setupFilesAfterEnv: ['<rootDir>/src/jest.setup.ts'],
|
2023-06-29 00:59:23 -05:00
|
|
|
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}'],
|
|
|
|
coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/', '/src/include.d/'],
|
|
|
|
coverageReporters: ['text-summary', 'lcov'],
|
2023-04-20 11:21:21 -05:00
|
|
|
transform: {
|
|
|
|
'^.+\\.(t|j)sx?$': [
|
|
|
|
'@swc/jest',
|
|
|
|
{
|
|
|
|
sourceMaps: true,
|
|
|
|
jsc: {
|
|
|
|
transform: {
|
|
|
|
react: {
|
|
|
|
runtime: 'automatic',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'\\.(svg)$': 'jest-transformer-svg',
|
|
|
|
'\\.(png)$': 'jest-transform-stub',
|
|
|
|
},
|
|
|
|
moduleNameMapper: {
|
|
|
|
'^@/(.*)$': '<rootDir>/src/$1',
|
|
|
|
'^@logto/shared/(.*)$': '<rootDir>/../shared/lib/$1',
|
|
|
|
'\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
|
|
|
|
},
|
2022-12-23 10:19:49 -05:00
|
|
|
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto|@silverhand))/)'],
|
2022-11-22 03:47:17 -05:00
|
|
|
};
|
2022-02-19 02:14:23 -05:00
|
|
|
|
|
|
|
export default config;
|