-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
33 lines (30 loc) · 1.11 KB
/
jest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// https://nextjs.org/docs/app/building-your-application/testing/jest
import { type Config } from '@jest/types';
import nextJest from 'next/jest.js';
const createJestConfig = nextJest({
dir: './',
});
const jestConfig: Config.InitialOptions = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
// moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths),
moduleNameMapper: { '^~/data/(.*)$': '<rootDir>/_tests__/data/$1', '^@/(.*)$': '<rootDir>/src/$1' },
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
target: 'esnext',
},
},
],
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.tsx'],
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
coveragePathIgnorePatterns: ['src/(middleware|locales|i18n).ts', 'src/app/robots.ts', 'src/.*/layout.tsx'],
coverageReporters: ['lcov', 'text', 'text-summary'],
bail: true,
testRegex: String.raw`__tests__/.+\.test\.(ts|tsx)$`,
errorOnDeprecated: true,
verbose: true,
};
export default createJestConfig(jestConfig);