File tree Expand file tree Collapse file tree 2 files changed +19
-11
lines changed Expand file tree Collapse file tree 2 files changed +19
-11
lines changed 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' ) : { } ;
3
6
4
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest } */
5
7
module . exports = {
6
8
preset : 'ts-jest' ,
7
9
testEnvironment : 'jsdom' ,
8
10
setupFilesAfterEnv : [ '<rootDir>/src/test/jest-setup.ts' ] ,
9
11
watchPlugins : [ 'jest-watch-typeahead/filename' , 'jest-watch-typeahead/testname' ] ,
10
12
roots : [ '<rootDir>' ] ,
11
- modulePaths : [ compilerOptions . baseUrl ] ,
13
+ modulePaths : tsConfig . compilerOptions ? [ tsConfig . compilerOptions . baseUrl ] : [ ] ,
12
14
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'
16
20
}
17
- }
21
+ } ;
Original file line number Diff line number Diff line change 11
11
"module" : " ESNext" ,
12
12
"moduleResolution" : " Node" ,
13
13
"resolveJsonModule" : true ,
14
- "isolatedModules" : true ,
15
- "noEmit" : true ,
14
+ "isolatedModules" : false ,
16
15
"incremental" : true ,
17
16
"jsx" : " react-jsx" ,
18
17
"importHelpers" : true ,
28
27
},
29
28
"plugins" : [
30
29
{ "transform" : " typescript-transform-paths" , "afterDeclarations" : true }
31
- ]
30
+ ],
31
+ "declaration" : true ,
32
+ "declarationMap" : true ,
33
+ "emitDeclarationOnly" : true ,
34
+ "outDir" : " dist" ,
35
+ "noEmit" : false
32
36
},
33
37
"include" : [" src" , " test" , " vite.config.ts" ],
34
38
"exclude" : [" jest.config.js" , " .eslintrc.js" , " prepare.js" ]
You can’t perform that action at this time.
0 commit comments