I am trying to use Enzyme to test my React application and I'm coming across this error. I haven't seen it mentioned anywhere else and can't figure it out.
Here is the stack trace:
TypeError: Cannot convert undefined or null to object
at hasOwnProperty (<anonymous>)
at Object.<anonymous> (../node_modules/react-shallow-renderer/cjs/react-shallow-renderer.js:54:21)
at Object.<anonymous> (../node_modules/react-shallow-renderer/index.js:3:18)
at Object.<anonymous> (../node_modules/react-test-renderer/shallow.js:3:18)
Here is the code from my test which is causing it.
const Enzyme = require('enzyme');
const Adapter = require('enzyme-adapter-react-15');
Enzyme.configure({ adapter: new Adapter() });
..... rest of test file
Dependencies from package.json
"react": "15.6.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-15": "^1.4.3",