-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
52 lines (49 loc) · 1.37 KB
/
jest.config.js
File metadata and controls
52 lines (49 loc) · 1.37 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const nextJest = require('next/jest');
const createJestConfig = nextJest({
dir: './',
});
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
resetMocks: true,
testEnvironment: 'jest-environment-jsdom',
maxWorkers: '50%',
workerIdleMemoryLimit: '2GB',
testTimeout: 15000,
slowTestThreshold: 10000,
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testMatch: ['<rootDir>/src/**/*.test.{ts,tsx}', '<rootDir>/src/**/*.spec.{ts,tsx}'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/*.stories.{ts,tsx}',
'!src/**/__tests__/**',
'!src/**/index.ts',
],
coverageThreshold: {
global: {
branches: 70,
functions: 70,
lines: 70,
statements: 70,
},
},
coverageReporters: ['text', 'text-summary', 'lcov'],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
transformIgnorePatterns: [
'node_modules/(?!(.*\\.mjs$|@vercel/analytics|@vercel/speed-insights|@pythnetwork|@tanstack/react-query|viem|@wagmi))',
],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'mjs'],
transform: {
'^.+\\.(ts|tsx|js|jsx|mjs)$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
useESM: true,
},
],
},
};
module.exports = createJestConfig(customJestConfig);