-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
jest.config.ts
38 lines (34 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
34
35
36
37
38
import type { Config } from '@jest/types'
import nextJest from 'next/jest'
import { pathsToModuleNameMapper } from 'ts-jest'
import { compilerOptions } from './tsconfig.json'
const createJestConfig = nextJest({
dir: './',
})
// Add any custom config to be passed to Jest.
const customJestConfig: Config.InitialOptions = {
preset: 'ts-jest',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'],
testMatch: [
'<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/**/*.{spec,test}.{js,jsx,ts,tsx}',
],
testPathIgnorePatterns: [
'/node_modules/',
'/.next/',
'/.vercel/',
'/.playwright/',
],
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
}
// createJestConfig is exported this way to ensure that next/jest can load
// the Next.js config which is async.
export default createJestConfig(customJestConfig)