| 
									
										
										
										
											2023-09-12 20:49:03 +08:00
										 |  |  | const { compilerOptions } = require('./tsconfig.json'); | 
					
						
							|  |  |  | const { pathsToModuleNameMapper } = require("ts-jest"); | 
					
						
							| 
									
										
										
										
											2023-12-18 17:44:47 +08:00
										 |  |  | const esModules = ["lodash-es", "nanoid"].join("|"); | 
					
						
							| 
									
										
										
										
											2023-09-12 20:49:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** @type {import('ts-jest').JestConfigWithTsJest} */ | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |   preset: 'ts-jest', | 
					
						
							|  |  |  |   testEnvironment: 'node', | 
					
						
							|  |  |  |   roots: ['<rootDir>'], | 
					
						
							|  |  |  |   modulePaths: [compilerOptions.baseUrl], | 
					
						
							| 
									
										
										
										
											2023-12-18 17:44:47 +08:00
										 |  |  |   moduleNameMapper: { | 
					
						
							|  |  |  |     ...pathsToModuleNameMapper(compilerOptions.paths), | 
					
						
							|  |  |  |     "^lodash-es(/(.*)|$)": "lodash$1", | 
					
						
							|  |  |  |     "^nanoid(/(.*)|$)": "nanoid$1", | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-09-12 20:49:03 +08:00
										 |  |  |   "transform": { | 
					
						
							|  |  |  |     "(.*)/node_modules/nanoid/.+\\.(j|t)sx?$": "ts-jest" | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-12-18 17:44:47 +08:00
										 |  |  |   "transformIgnorePatterns": [`/node_modules/(?!${esModules})`], | 
					
						
							| 
									
										
										
										
											2023-09-12 20:49:03 +08:00
										 |  |  |   "testRegex": "(/__tests__/.*\.(test|spec))\\.(jsx?|tsx?)$", | 
					
						
							|  |  |  | }; |