-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathjest.config.js
More file actions
37 lines (36 loc) · 980 Bytes
/
jest.config.js
File metadata and controls
37 lines (36 loc) · 980 Bytes
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
const config = {
preset: 'ts-jest/presets/js-with-ts',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
},
],
},
moduleNameMapper: {
'^[../]+src/([^/]+)$': '<rootDir>/src/$1.ts',
'^[../]+src/resources/([^/]+)$': '<rootDir>/src/resources/$1.ts',
'^[../]+src/models/([^/]+)$': '<rootDir>/src/models/$1.ts',
// Handle .js imports in TypeScript files for Jest
'^(.+)\\.js$': '$1',
},
// Handle ESM modules like node-fetch v3
extensionsToTreatAsEsm: ['.ts'],
transformIgnorePatterns: [
'node_modules/(?!(node-fetch|data-uri-to-buffer|fetch-blob|formdata-polyfill)/)',
],
// Set up jest-fetch-mock
setupFilesAfterEnv: ['<rootDir>/tests/setupTests.ts'],
coverageThreshold: {
global: {
functions: 80,
lines: 80,
statements: 80,
},
},
clearMocks: true,
collectCoverage: true,
coverageReporters: ['text', 'cobertura'],
};
module.exports = config;