You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see there is a closed issue #163. It works around the issue but it does not look like it fully solves problem. I'm opening this one to be more specific and provide a test case that wrongly fails.
Enzyme's matchesElement only matches the props that the user supplies. If there are additional props that aren't specified in the match it still passes.
However, toMatchElement functions differently. It requires that ALL props match. This is extremely inconvenient and often impractical to specify all the other props.
Here's an example the failing behavior:
it('jest-enyzme bug',()=>{constwrapper=shallow(<form><inputtype="text"id="description"placeholder="additonal prop for negative testing"/></form>)constinput=wrapper.find('input')// Passes when the given subset of props matchexpect(input.matchesElement(<inputid="description"/>)).toEqual(true)// Detects when one of the props does not matchexpect(input.matchesElement(<inputid="noMatch"/>)).toEqual(false)// This test should NOT fail. enzyme-matchers does not function the same.// It wrongly requires ALL the props to match.expect(input).toMatchElement(<inputid="description"/>,{ignoreProps: false})})
The text was updated successfully, but these errors were encountered:
I see there is a closed issue #163. It works around the issue but it does not look like it fully solves problem. I'm opening this one to be more specific and provide a test case that wrongly fails.
Enzyme's
matchesElement
only matches the props that the user supplies. If there are additional props that aren't specified in the match it still passes.However,
toMatchElement
functions differently. It requires that ALL props match. This is extremely inconvenient and often impractical to specify all the other props.Here's an example the failing behavior:
The text was updated successfully, but these errors were encountered: