-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
2.4.5 - afterEach run multiple extra times and wrong number of tests reported if a test errors #2216
Comments
I reproduced some of the issues here: https://github.com/rally25rs/mocha-issue2216 but can't seem to reproduce whatever was making the afterEach get called multiple times... I can get some weird behavior to occur, mostly centered around async tests that throw an exception. |
Not sure if this helps at all either, but with the HTML reporter / running in a browser, I see the same test triplicated (the 2 failures and last success are all the same test. there are actually only 3 tests not 5). There is an error on the console, and it seems if you debug there, Related to what I point out in my example github code from the previous comment, it is actually the 2nd test in that screenshot that is throwing the error, but it causes the 3rd test to fail... which then reports itself as 2 failures and 1 success. |
Part of this is related to #2112 |
Yup, this is a duplicate of #2083 and should be fixed in the next release, sorry! |
I think I've stumbled into a weird edge case here.
I have global-level
beforeEach
andafterEach
handlers, as well as some nested in adescribe
, basically like this:It seems that if all my tests pass, I get the output
Note the test count is 91 (correct) and it measures the execution time at 0.702s.
However, if one of my tests errors, I get:
Note now that after the failing "test 3" the nested
afterEach
is called twice, and the globalafterEach
is called 3 times!Also it reports 94/91 tests now (cool, it ran 103% of my tests! :) ) and reports the execution time as
NaN
I'll try to distill my actual test code into a sharable example to reproduce this behavior, but I suspect there is some weird edge case I've run into that will disappear as soon as I change anything...
The text was updated successfully, but these errors were encountered: