Closed voda closed 3 years ago
ah shoot, yep cause I have to make an assertion in order to grab the reference to the this.expect
. I'm not quite sure what to do now if this is going to break folks code. Except I'm not sure most folks use expect.assertions.
I think with this behavior there isn't any good workaround. If you copy the test twice into the file, only the first one fails and the second one passes, which can be quite confusing.
I have two possible ideas, how it could be solved (don't know that much about jest, so not sure if it is doable):
1) try to load the expect from jest's node_modules: if require('expect/build/jasmineUtils')
fails then try require('jest/node_modules/expect/build/jasmineUtils')
2) since the extra assertion only affects the first test, is there a way to reset the done assertions?
Some good ideas and can give them a try.
On Thu, Oct 7, 2021 at 4:44 AM Ondřej Vodáček @.***> wrote:
I think with this behavior there isn't any good workaround. If you copy the test twice into the file, only the first one fails and the second one passes, which can be quite confusing.
I have two possible ideas, how it could be solved (don't know that much about jest, so not sure if it is doable):
- try to load the expect from jest's node_modules: if require('expect/build/jasmineUtils') fails then try require('jest/node_modules/expect/build/jasmineUtils')
- since the extra assertion only affects the first test, is there a way to reset the done assertions?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/timkindberg/jest-when/issues/88#issuecomment-937582598, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJA3WVOPQ5CWDD7RN42RDUFVMXXANCNFSM5FOIHRWQ .
-- Thanks,
Tim Kindberg
Fixed in v3.4.2 (thanks for the suggestion it helped me fix it)
Thanks for the fix, I can confirm it works and I haven't found any more issues with the new version and our project.
Hey, after updating to v3.4.1, this code starts to fail
with:
After removing the
require
the test passes.