-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjest.config.js
More file actions
26 lines (25 loc) · 888 Bytes
/
jest.config.js
File metadata and controls
26 lines (25 loc) · 888 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
/** `@type` {import('ts-jest').JestConfigWithTsJest} */
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
modulePaths: ['<rootDir>/src'], // mirrors tsconfig baseUrl
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: {
module: 'CommonJS', // override ESNext → CJS for Jest
moduleResolution: 'node', // match CommonJS resolution
}
}],
// Also transform .js files from ESM-only node_modules
'^.+\\.js$': 'babel-jest',
},
transformIgnorePatterns: [
'/node_modules/(?!(filenamify|filename-reserved-regex|strip-outer|trim-repeated))',
],
moduleNameMapper: {
'^obsidian$': '<rootDir>/src/test/__mocks__/obsidian.ts',
'^filenamify$': '<rootDir>/src/test/__mocks__/filenamify.ts',
}
};