-
Notifications
You must be signed in to change notification settings - Fork 412
Fix checkHtmlElement helper #67
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
Conversation
Thanks a lot! I realized this when I tried to adapt I'll see if I have time to check all this and maybe add this new capability right here, or maybe I'll add it in a different PR so as not to delay this any further. |
If you do so, please parameterize by string names, not actual references, e.g. |
Thanks! That was exactly the insight I was looking for. |
As for the failing test, Why is exactly |
I it was for me I'd remove this check instead of hacking around this issue. For me it seems it doesn't test for anything useful |
Interesting. I am too not convinced of the added complexity of what I was thinking to add to it. Or even the complexity that it has now. But it certainly serves a purpose in the clarity of how this failure is presented to the user. Can you please tell me more: what would happen if people pass to |
I'm talking about |
Oh I see, let me check the code around that and recall what was it for. |
I think the reason behind it is to confirm that the html string passed to it is indeed valid html. The intention in that case would be for it to fail if you pass something like I agree that you probably can remove it. |
Okay, I've removed it |
} catch (e) { | ||
// Can throw for Document: | ||
// https://github.com/jsdom/jsdom/issues/2304 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sheerun can you provide more detail about why is this happening?
I'd like to understand the code in the future, and merely visiting the link did not make it evident what's happening here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea why, I know it happens and this try catch is needed for tests to pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what do you mean with "Can throw for Document", and why do you link it to that issue in jsdom?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens for this test where I pass Document instance: https://github.com/gnapse/jest-dom/pull/67/files#diff-f00ff29fba28ce3d11d8b6a726c3788eR51
The error I'm seeing when this test fails is the same as in the issue linked. I suspect this is issue with printWithType
helper and internals of jsdom
but it's not something I can fix easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's best if you remove this try catch and see what I mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind the error is still shown to the user but is little less descriptive as it doesn't show that Document instance has been passed
🎉 This PR is included in version 2.1.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Answers #64