-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.js
More file actions
92 lines (86 loc) · 2.78 KB
/
jest.config.js
File metadata and controls
92 lines (86 loc) · 2.78 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// eslint-disable-next-line @typescript-eslint/no-var-requires
/** biome-ignore-all lint/style/noCommonJs: config file */
process.env.TZ = 'UTC'
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: './',
})
const esModules = [
'@wagmi',
'html-tags',
'@walletconnect',
'viem',
'@tanstack',
'uint8arrays',
'@mdx-js',
].join('|')
// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// 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', __dirname],
moduleFileExtensions: ['js', 'jsx', 'tsx', 'ts'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testMatch: [
'**/__tests__/**/*.(spec|test).(ts|tsx|js|jsx)',
'**/*.(spec|test).(ts|tsx|js|jsx)',
],
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
collectCoverageFrom: [
'./src/utils/**',
'!./src/__tests__/**',
'!./src/**/*.d.ts',
'!./src/utils/services/calendar.service.types.ts',
'!./src/instrumentation*.ts',
'!./src/testing/**',
'!./src/**/*.test.ts',
'!./src/**/*.spec.ts',
'!./src/**/*.test.tsx',
'!./src/**/*.spec.tsx',
// Exclude non-testable framework boilerplate and CSS-in-JS
'!./src/styles/**',
'!./src/pages/**',
],
verbose: true,
resolver: `./resolver.js`,
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
},
moduleNameMapper: {
swr: '<rootDir>/__mocks__/swr.js',
'@meta/(.*)': 'src/types/$1',
'@utils/(.*)': 'src/utils/$1',
'@components/(.*)': 'src/components/$1',
'@/(.*)': 'src/$1',
'swiper/react': 'swiper/react/swiper-react.js',
'swiper/css': '<rootDir>/__mocks__/jestMock.js',
'(.*)PlansMobileSlider': '<rootDir>/__mocks__/jestMock.js',
'(.*)Features': '<rootDir>/__mocks__/jestMock.js',
'swiper/css/pagination': '<rootDir>/__mocks__/jestMock.js',
'react-intersection-observer': '<rootDir>/__mocks__/intersection.js',
'html-tags': '<rootDir>/__mocks__/htmlTags.js',
ws: '<rootDir>/__mocks__/ws.js',
},
testTimeout: 30000,
preset: 'ts-jest/presets/default-esm',
transformIgnorePatterns: [`node_modules/(?!(${esModules})/)`],
globals: {
Uint8Array,
ArrayBuffer,
},
coverageThreshold: {
global: {
statements: 60,
branches: 60,
functions: 60,
lines: 60,
},
},
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)