-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
33 lines (29 loc) · 1.07 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
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: './'
});
// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
roots: ['<rootDir>'],
verbose: true,
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
collectCoverage: true,
moduleDirectories: ['node_modules', 'src'],
collectCoverageFrom: ['src/**/*.test.ts(x)?', '!src/**/*-stories.tsx'],
setupFilesAfterEnv: ['<rootDir>/.jest/jest.setup.ts'],
modulePaths: ['<rootDir>/src/', '<rootDir>/.jest'],
preset: 'ts-jest',
setupFiles: ['jest-canvas-mock'],
bail: 1,
moduleNameMapper: {
'^.+\\.(css|less|scss)$': 'babel-jest',
'\\.svg$': '<rootDir>/.jest/mocks/svgMock.ts',
'@/(.*)': '<rootDir>/$1'
}
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
const config = createJestConfig(customJestConfig);
export default config;