Test script throws error when prop-types are imported
Closed this issue ยท 1 comments
The problem
Downloaded your build, love it. Thanks for maintaining it ๐. I needed to add prop-types library since we are now working in React 16 so I added it as a dependency. I am suggesting the library is added by default since this is how React 16 deals with prop types now. This library creates some issues in enzyme.
Details
npm start works fine but when you run npm test you get a horrible error
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import React from 'react';
I found a fix for this by adding the following to package.json "jest" configuration.
, "transformIgnorePatterns": [ "node_modules/(?!(prop-types)/)" ]
Found fix here: jestjs/jest#3202 (comment)
This allows that library to be whitelisted because it does not transpile by default. This fixes the first issue but now you get tests/components/App.test.js
TypeError: Super expression must either be null or a function, not undefined
line 3 import Adapter from 'enzyme-adapter-react-16';
This is where I am at and I don't see how to fix this. This issue has the best thread about the issue: enzymejs/enzyme#875
Hi @Blumed, thanks for the detailed report. I have to check what is happening. Will write once I have something.