enzyme-adapter-preact icon indicating copy to clipboard operation
enzyme-adapter-preact copied to clipboard

Invariant Violation: ReactShallowRenderer render(): Invalid component element.

Open jahilldev opened this issue 6 years ago • 3 comments

I've got everything setup according to your docs however whenever I attempt to shallow render a very simple class based component I get the following error:

Invariant Violation: ReactShallowRenderer render(): Invalid component element.

For clarity I'm using:

"typescript": "2.8.3"
"preact": "8.2.9"
"mocha": "^5.1.1"
"enzyme": "^3.3.0"
"enzyme-adapter-preact": "^0.2.0"

I've put together a repo illustrating this here: https://github.com/jhdevuk/typescript-preact-enyme

@awinogradov @sanpoChew @aweary

Thanks

jahilldev avatar May 16 '18 09:05 jahilldev

+1 Have the same issue

bdzhilka avatar May 17 '18 09:05 bdzhilka

Working on a fix for this, should have a merge request ready soon

sanpoChew avatar May 29 '18 14:05 sanpoChew

I still get this error using jest 23.6.0 , enzyme 3.8.0 , and enzyme-preact-adapter 0.2.0 . One not-great workaround is to import React from 'preact-compat'; instead of from 'preact' in test files.

orzechowskid avatar Jan 27 '19 21:01 orzechowskid