import path from 'path' ; import { CWD , DIR_NAME_CJS , DIR_NAME_COMPONENT_LIBRARY , DIR_NAME_ESM , DIR_NAME_ICON , DIR_NAME_SOURCE , DIR_NAME_TEST , DIR_NAME_UMD , } from '../../constant' ; import getConfigProcessor from '../../scripts/utils/getConfigProcessor' ; const baseConfig = { rootDir : CWD , setupFiles : [ `./${ DIR_NAME_TEST }/setup.js` ] , moduleFileExtensions : [ 'ts' , 'tsx' , 'js' , 'json' , 'jsx' , 'node' , 'mjs' , 'md' ] , snapshotSerializers : [ require . resolve ( 'enzyme-to-json/serializer' ) ] , testPathIgnorePatterns : [ '/node_modules/' ] , testRegex : '.*\\.test\\.(j|t)sx?$' , transform : { '^.+\\.jsx?$' : path . resolve ( __dirname , './babelTransform.js' ) , '^.+\\.tsx?$' : require . resolve ( 'ts-jest' ) , '.*\\.md$' : path . resolve ( __dirname , './mdTransform.js' ) , '.*\\.(css|less|scss)$' : path . resolve ( __dirname , './styleTransform.js' ) , } , transformIgnorePatterns : [ 'node_modules/[^/]+?/(?!(es|node_modules)/)' ] , } ; const config = { client : { ... baseConfig , testEnvironment : 'jsdom' , clearMocks : true , collectCoverage : true , collectCoverageFrom : [ `${ DIR_NAME_SOURCE }/**/*.{ts,tsx}` , `${ DIR_NAME_COMPONENT_LIBRARY }/**/*.{ts,tsx}` , '!**/style/*' , ] , coverageDirectory : './.coverage/' , coveragePathIgnorePatterns : [ '/node_modules/' , `/${ DIR_NAME_CJS }/` , `/${ DIR_NAME_ESM }/` , `/${ DIR_NAME_UMD }/` , `/${ DIR_NAME_ICON }/` , ] , coverageReporters : [ 'json' , 'json-summary' , 'lcov' , 'text' , 'clover' , 'text-summary' ] , } , node : { ... baseConfig , testEnvironment : 'node' , testRegex : 'demo\\.test\\.(j|t)sx?$' , } , } ; const processor = getConfigProcessor < { client : Function ; node : Function ; } > ( 'jest' ) ; if ( processor ) { if ( processor . client ) { config . client = processor . client ( config . client ) || config . client ; } if ( processor . node ) { config . node = processor . node ( config . node ) || config . node ; } } export default config ;