-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.ts
34 lines (32 loc) · 1.32 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
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';
const config: InitialOptionsTsJest = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
verbose: true,
clearMocks: true,
setupFilesAfterEnv: ['<rootDir>/__tests__/jest.setup.js', '<rootDir>/__tests__/jest.setEnvVars.js', 'jest-extended'],
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>/node_modules/',
'<rootDir>/__tests__/helpers',
'<rootDir>/__tests__/mocks',
'<rootDir>/__tests__/jest.setEnvVars.js',
'<rootDir>/__tests__/jest.setup.js',
],
transform: {
// Use babel-jest to transpile tests with the next/babel preset
// https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
'\\.(gql|graphql)$': 'jest-transform-graphql',
},
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__tests__/mocks/fileMock.js',
'\\.(css|less)$': '<rootDir>/__tests__/mocks/styleMock.js',
'\\.svg': '<rootDir>/__tests__/mocks/svgrMock.js',
},
moduleDirectories: ['node_modules', '<rootDir>/node_modules', '.'],
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.[jt]sx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};
export default config;