ts-jest: TypeError: Cannot read property 'configure' of undefined
Issue :
After updating from ts-jest@22.0.4 many tests fail with TypeError: Cannot read property 'configure' of undefined
it seems to be happening at Enzyme.configure({ adapter: new enzymeAdapterReact16() });
import Enzyme, { shallow } from 'enzyme';
import enzymeAdapterReact16 from 'enzyme-adapter-react-16';
import React from 'react';
import TaskMenuCall, { TaskMenuCallProps } from './TaskMenuCall';
Enzyme.configure({ adapter: new enzymeAdapterReact16() });
const getDefaultProps = (): TaskMenuCallProps & { onClick: jest.Mock } => ({
onClick: jest.fn(),
phones: [{ label: 'mobile', phone: '3521231234' }, { label: 'office', phone: '3525675678' }],
});
describe('TaskMenuCall component', () => {
it('shallow renders without crashing', () => {
const props = getDefaultProps();
shallow(<TaskMenuCall {...props} />);
});
});
Expected behavior :
Test keep running successfully
Debug log:
# content of ts-jest.log :
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 15
I have the same issue with
so apparently React is not being loaded (which is my first import). This happens on ts-jest 23.10.4 and 23.10.5.
Downgrading to 22.0.4 fixed the issue.