skip to Main Content

Reactjs – Strange behavior. Jest gives `Cannot find module` when importing components with absolute paths

My jest config clearMocks: true, rootDir: '../../', cacheDirectory: 'cache', testEnvironment: 'jsdom', modulePaths: [ '<rootDir>' ], setupFilesAfterEnv: [ '<rootDir>/config/jest/setup.ts' ], moduleDirectories: [ 'node_modules', 'src' ], moduleNameMapper: { '\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/config/jest/mocks/file.js', '\.s?css$': 'identity-obj-proxy' }, moduleFileExtensions: [ 'js', 'mjs', 'cjs', 'jsx', 'ts', 'tsx', 'json',…

VIEW QUESTION
Back To Top
Search