-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip __source
and __self
from renderToJsxString
#43
Comments
Hi there, Those attributes are added by I think we can install your hook into |
In case somebody else is still using Preact w/ CRA, this is what worked for me:
(put in |
Should have been resolved with #152. Feel free to reopen the issue if you still experiencing issues with the latest version. |
I'm integrating
preact-compat
intocreate-react-app
without ejecting and had quite a lot of success doing it so far.My setup
For the Jest tests, I managed to use
moduleNameMapper
to use thepreact-*
testing utilities instead of anything from React, something similar to this:The issue
While running the Jest tests, I've run into an issue when using
renderToJsxString
directly toexpect(renderToJsxString(<SomeComponent></SomeComponent>)).toMatchSnapshot();
there are__source
and__self
attributes on every component in the output.The output looks similar to this:
I managed to fix this by supplying my own
attributeHook
, but it means that I needed to recreate all of the functionality from within which is not the best for keeping in sync with updates.This is all I wanted to add inside
attributeHook
The
opts
I'm passing torenderToJsxString
are:I'm not sure if this is by design, or something that only happens with
preact-compat
or if it's related to me using themoduleNameMapper
setup written above.The solution could be to have a switch to filter for these fields, it could be to have a blacklist of attributes or it could be that there's an error on my part.
Can you help to figure it out?
The text was updated successfully, but these errors were encountered: