| 
									
										
										
										
											2025-05-06 15:07:22 -04:00
										 |  |  | import { pathsToModuleNameMapper } from 'ts-jest' | 
					
						
							|  |  |  | // In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
 | 
					
						
							|  |  |  | // which contains the path mapping (ie the `compilerOptions.paths` option):
 | 
					
						
							|  |  |  | import { compilerOptions } from './tsconfig.json' | 
					
						
							|  |  |  | import type { Config } from 'jest' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const jestConfig: Config = { | 
					
						
							|  |  |  |   // [...]
 | 
					
						
							|  |  |  |   preset: "ts-jest", | 
					
						
							|  |  |  |   transform: { | 
					
						
							|  |  |  |     "^.+\.tsx?$": ["ts-jest",{ babelConfig: true }], | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   testEnvironment: "jest-fixed-jsdom", | 
					
						
							| 
									
										
										
										
											2025-06-06 11:29:20 +10:00
										 |  |  |   // Include both standard test patterns and our custom .jesttest. pattern
 | 
					
						
							|  |  |  |   testMatch: [ | 
					
						
							|  |  |  |     "**/__tests__/**/*.[jt]s?(x)", | 
					
						
							|  |  |  |     "**/?(*.)+(spec|test).[tj]s?(x)", | 
					
						
							|  |  |  |     "**/?(*.)+(jesttest).[tj]s?(x)" | 
					
						
							|  |  |  |   ], | 
					
						
							| 
									
										
										
										
											2025-05-06 15:07:22 -04:00
										 |  |  |   // TAG: paths, path, baseUrl, alias
 | 
					
						
							|  |  |  |   // This is necessary to use tsconfig path aliases.
 | 
					
						
							|  |  |  |   moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../' }), | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default jestConfig |