We had to transform the cuix and cuix-core libraries in our jest testing setup in order to get the js modules working.
@@ -4,10 +4,6 @@ import '@testing-library/jest-dom';
import ReactExample from './ReactExample';
-// For now, this is needed to mock cuix components exported as ESM (ECMAScript module)
-jest.mock('cuix/dist/components/Button/PrimaryButton', () => () => undefined);
-jest.mock('@cloudera/cuix-core/icons/react/PlusCircleIcon', () => () => undefined);
-
// Required by the antd Pagination component
window.matchMedia = jest.fn().mockImplementation(query => {
return {
@@ -1,8 +1,9 @@
module.exports = {
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue'],
+ transformIgnorePatterns: ['node_modules/(?!(cuix|@cloudera/cuix-core)/)'],
transform: {
'^.+\\.(js|ts|jsx|tsx)$': 'babel-jest',
- '^.+\\.vue$': '@vue/vue3-jest',
+ '^.+\\.vue$': '@vue/vue3-jest'
},
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',