enzymejs / enzyme-matchers

Jasmine/Jest assertions for enzyme
MIT License
892 stars 116 forks source link

Host node matchers #337

Open GreenGremlin opened 4 years ago

GreenGremlin commented 4 years ago

This PR is a follow-on to https://github.com/FormidableLabs/enzyme-matchers/pull/336, until it is merged, this PR will also include changes from that PR.

This change adds three new matchers, similar to the existing toContainMatchingElement matchers, except that the new matchers only match against "host nodes". Enzyme v3.1 added a hostNodes method that filters a result set to just "host nodes". According to the hostNodes documentation, "host nodes" are "are HTML elements rather than custom React components, e.g. <div> versus <MyComponent>."

GreenGremlin commented 4 years ago

Given that hostNodes was added in Enzyme v3.1, should there be some safeguards around the new marchers? What versions of Enzyme are officially supported?

ljharb commented 4 years ago

I consider it a bug that enzyme-matchers does not declare a peerDependency range on enzyme. It's probably fine to publish these new matchers without guards (since nobody can already be using them), but after that's out, a breaking change should probably be published that adds a peerDep on enzyme v3.1+ (or even, v3.11+).

GreenGremlin commented 4 years ago

Is there anything I can do to help get this merged?

GreenGremlin commented 12 months ago

Closing this PR, due to its age, but it would still be nice to have.

ljharb commented 12 months ago

Age shouldn’t be a factor :-) let’s leave this open.