2026-03-15 11:44:23 +08:00
|
|
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
|
|
|
export default {
|
|
|
|
|
preset: 'ts-jest',
|
|
|
|
|
testEnvironment: 'node',
|
|
|
|
|
testMatch: ['**/*.test.ts'],
|
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
2026-07-13 11:08:48 +08:00
|
|
|
moduleNameMapper: {
|
|
|
|
|
// Resolve .js imports to .ts source files (ESM convention in TS source)
|
|
|
|
|
'^(.+)\\.js$': ['$1.ts', '$1.tsx', '$1.js'],
|
|
|
|
|
},
|
2026-03-15 11:44:23 +08:00
|
|
|
transform: {
|
|
|
|
|
'^.+\\.tsx?$': [
|
|
|
|
|
'ts-jest',
|
|
|
|
|
{
|
|
|
|
|
tsconfig: {
|
|
|
|
|
target: 'ES2020',
|
|
|
|
|
module: 'ESNext',
|
|
|
|
|
moduleResolution: 'node',
|
|
|
|
|
esModuleInterop: true,
|
|
|
|
|
strict: true,
|
|
|
|
|
skipLibCheck: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
};
|