-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.js
More file actions
54 lines (54 loc) · 1.84 KB
/
jest.config.js
File metadata and controls
54 lines (54 loc) · 1.84 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
export default {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
modulePaths: ['<rootDir>'],
moduleDirectories: ['node_modules', '<rootDir>'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^(\\.{1,2}/.*)\\.js$': '$1',
'^\\.(css|less|scss)$': 'identity-obj-proxy',
'^axios$': '<rootDir>/src/__mocks__/axios.ts',
'^(\.{1,2}/.*)\\.js$': '$1',
},
extensionsToTreatAsEsm: ['.ts', '.tsx', '.js'],
transform: {
'^.+\\.(t|j)sx?$': [
'ts-jest',
{
useESM: true,
tsconfig: 'tsconfig.json',
isolatedModules: true,
diagnostics: false,
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(uuid|axios|@babel|@jest|@types|chalk|ansi-styles|strip-ansi|jest-util|jest-snapshot|jest-circus|pretty-format|react-is|@testing-library|@esbuild|node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill|@modelcontextprotocol)/)',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node', 'mjs'],
testMatch: [
'**/__tests__/**/*.test.[jt]s?(x)',
'**/?(*.)+(spec|test).[jt]s?(x)',
],
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
coveragePathIgnorePatterns: ['/node_modules/'],
verbose: true,
testEnvironmentOptions: {
NODE_ENV: 'test',
url: 'http://localhost:3000',
},
setupFiles: ['<rootDir>/jest.setup.js'],
setupFilesAfterEnv: ['<rootDir>/src/__tests__/setup.ts'],
testTimeout: 30000,
testPathIgnorePatterns: ['/node_modules/'],
globals: {
'ts-jest': {
isolatedModules: true,
tsconfig: 'tsconfig.json',
useESM: true,
},
},
};