Closed shawyu closed 5 years ago
@shawyu good research! Would you mind taking a stab at fixing it? The matcher is located at packages/enzyme-matchers/src/assertions
and you can run the jest tests in packages/jest-enzyme
with yarn test
hey @blainekasten thanks for taking a look! I think the change in 9159433 is all that is needed for a fix, unless there is something else I should submit? I'm not sure how to write a unit test for this inside this repository since the problem seems to lie on the boundary of jest
and enzyme-matchers
. I could update assertions in the unit tests to assert on toBe(true)
rather than toBeTruthy
(and similar for falsy)
lololol. I'm so sorry. I thought this was an issue.
I think that is actually smart to change the tests to check for literal true/false. Could you do that for all the assertions and make sure they all pass? Thanks so much for the contribution!
done! the changes also turned up a bad assertion that was passing correctly, but for the wrong reasons
Awesome! I'm happy to merge this if you can squash it down to 1 commit!
I rewrote the squashed commit once on my fork and it had a PR reference in the title so the history above this comment is confusing, but there is actually only one commit to merge now (see the Commits tab)
Awesome! Thanks @shawyu, do you want me to cut a release immediately? Is this bug blocking you?
@blainekasten that would be really helpful if you could cut one! I could work around the issue for now since I can use other assertion patterns so not a huge blocker, though.
Sorry for the delay! Was a crazy busy week. Just published 7.0.1
jest
is throwing an error on the.toContainMatchingElement()
matcher (see output below). The easiest fix seems to stop using truthy return values forpass
and using an explicit> 0
operator to return booleantrue/false
rather than0
or something>0
.Possibly related to #276.
I've created a minimal example repository to reproduce this issue: https://github.com/shawyu/enzyme-matchers-example
which produces this output: