File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const { pathsToModuleNameMapper } = require ( 'ts-jest' )
2- const { compilerOptions } = require ( './tsconfig' )
1+ const { pathsToModuleNameMapper } = require ( 'ts-jest' ) ;
2+ const fs = require ( 'fs' ) ;
3+
4+ // Verifica que tsconfig.json existe antes de requerirlo
5+ const tsConfig = fs . existsSync ( './tsconfig.json' ) ? require ( './tsconfig.json' ) : { } ;
36
4- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest } */
57module . exports = {
68 preset : 'ts-jest' ,
79 testEnvironment : 'jsdom' ,
810 setupFilesAfterEnv : [ '<rootDir>/src/test/jest-setup.ts' ] ,
911 watchPlugins : [ 'jest-watch-typeahead/filename' , 'jest-watch-typeahead/testname' ] ,
1012 roots : [ '<rootDir>' ] ,
11- modulePaths : [ compilerOptions . baseUrl ] ,
13+ modulePaths : tsConfig . compilerOptions ? [ tsConfig . compilerOptions . baseUrl ] : [ ] ,
1214 moduleNameMapper : {
13- ...pathsToModuleNameMapper ( compilerOptions . paths ) ,
14- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$" : "<rootDir>/__mocks__/fileMock.js" ,
15- "\\.(css)$" : "identity-obj-proxy"
15+ ...( tsConfig . compilerOptions && tsConfig . compilerOptions . paths
16+ ? pathsToModuleNameMapper ( tsConfig . compilerOptions . paths , { prefix : '<rootDir>/' } )
17+ : { } ) ,
18+ '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$' : '<rootDir>/__mocks__/fileMock.js' ,
19+ '\\.(css)$' : 'identity-obj-proxy'
1620 }
17- }
21+ } ;
Original file line number Diff line number Diff line change 1111 "module" : " ESNext" ,
1212 "moduleResolution" : " Node" ,
1313 "resolveJsonModule" : true ,
14- "isolatedModules" : true ,
15- "noEmit" : true ,
14+ "isolatedModules" : false ,
1615 "incremental" : true ,
1716 "jsx" : " react-jsx" ,
1817 "importHelpers" : true ,
2827 },
2928 "plugins" : [
3029 { "transform" : " typescript-transform-paths" , "afterDeclarations" : true }
31- ]
30+ ],
31+ "declaration" : true ,
32+ "declarationMap" : true ,
33+ "emitDeclarationOnly" : true ,
34+ "outDir" : " dist" ,
35+ "noEmit" : false
3236 },
3337 "include" : [" src" , " test" , " vite.config.ts" ],
3438 "exclude" : [" jest.config.js" , " .eslintrc.js" , " prepare.js" ]
You can’t perform that action at this time.
0 commit comments