-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathjest.config.cjs
More file actions
62 lines (60 loc) · 1.89 KB
/
Copy pathjest.config.cjs
File metadata and controls
62 lines (60 loc) · 1.89 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
55
56
57
58
59
60
61
62
/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/tests/unit'],
testMatch: ['**/*.test.ts', '**/*.test.tsx'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
coverageDirectory: 'coverage',
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: './test-results', // The directory where the XML file will be saved
outputName: 'unit-results.xml', // The name of the JUnit XML file
suiteNameTemplate: '{filepath}', // Optional: customize the suite name
classNameTemplate: '{classname}', // Optional: customize the class name
titleTemplate: '{title}', // Optional: customize the test title
},
],
],
collectCoverageFrom: [
'services/**/*.ts',
'utils/socketManager.ts',
'!**/*.d.ts',
'!**/node_modules/**',
],
transform: {
'^.+\\.mjs$': 'babel-jest', // Added to handle .mjs files if any
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
useESM: true,
tsconfig: {
module: 'ES2022',
moduleResolution: 'bundler', // bundler is a better choice for modern apps
esModuleInterop: true,
allowSyntheticDefaultImports: true,
},
},
],
},
transformIgnorePatterns: [
// recharts is mocked, so it doesn't need to be explicitly transformed or ignored from transformation.
'/node_modules/(?!uuid|@asteasolutions/zod-to-openapi|@garmin/fitsdk)',
],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'^@/(.*)$': '<rootDir>/$1',
'^recharts$': '<rootDir>/tests/__mocks__/recharts.tsx',
'^@garmin/fitsdk$': '<rootDir>/tests/__mocks__/garmin-fitsdk.ts',
},
testTimeout: 10000,
setupFilesAfterEnv: [
'<rootDir>/tests/jest-setup.js',
'<rootDir>/tests/unit/jest.setup.js',
],
}
module.exports = config