-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.ts
More file actions
36 lines (31 loc) · 1.13 KB
/
jest.config.ts
File metadata and controls
36 lines (31 loc) · 1.13 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
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
import type { Config } from 'jest'
import nextJest from '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 config: Config = {
// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,
collectCoverageFrom: ['<rootDir>/src/**/*.(ts|tsx)'],
coverageProvider: 'v8',
coveragePathIgnorePatterns: ['/node_modules/'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'@mock/(.*)$': '<rootDir>/__mock__/$1',
'@tests/(.*)$': '<rootDir>/__tests__/$1',
},
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: [''],
},
// Add more setup options before each test is run
setupFiles: ['./jest.polyfills.js'],
setupFilesAfterEnv: ['@testing-library/jest-dom', '@testing-library/react', '<rootDir>/jest.setup.ts'],
}
export default createJestConfig(config)