Fixed jest config to transform react-chartjs-2 lib

This commit is contained in:
Alejandro Celaya 2022-05-02 11:51:17 +02:00
parent c516969686
commit c8b78d04e2

View file

@ -26,13 +26,14 @@ module.exports = {
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'<rootDir>/.stryker-tmp', '<rootDir>/.stryker-tmp',
'/node_modules\\/(?!react-leaflet)\.(js|jsx|ts|tsx)$', 'node_modules\/(?!(\@react-leaflet|react-leaflet|leaflet|react-chartjs-2)\/)',
'^.+\\.module\\.scss$', '^.+\\.module\\.scss$',
], ],
moduleNameMapper: { moduleNameMapper: {
'^.+\\.module\\.scss$': 'identity-obj-proxy', '^.+\\.module\\.scss$': 'identity-obj-proxy',
// Reactstrap module resolution does not work in jest for some reason. Manually mapping it solves the problem // Reactstrap module resolution does not work in jest for some reason. Manually mapping it solves the problem
'reactstrap': '<rootDir>/node_modules/reactstrap/dist/reactstrap.umd.js', 'reactstrap': '<rootDir>/node_modules/reactstrap/dist/reactstrap.umd.js',
'react-chartjs-2': '<rootDir>/node_modules/react-chartjs-2/dist/index.js',
}, },
moduleFileExtensions: ['js', 'ts', 'tsx', 'json'], moduleFileExtensions: ['js', 'ts', 'tsx', 'json'],
}; };