This would be the same error TypeError: Cannot read property 'contextTypes' of undefined
when you are importing something that does not exist.
Here is an example:
AccountFormComponent.jsx
(incorrect class name):
export class FoeFormComponent extends React.Component { .... }
AccountFormComponent.test.jsx
:
import { shallow } from 'enzyme'
import { expect, assert } from 'chai'
import { AccountFormComponent } from '../../src/components/AccountFormComponent';
describe('', function () {
it('', function () {
const enzymeWrapper = shallow(<AccountFormComponent {...props} />);
});
});
Just add the following to your test file to be sure the component exists:
it('should exists', function () {
assert.isDefined(AccountFormComponent);
});
which prints AssertionError: expected undefined to not equal undefined
instead