[BUG] mocha-globals beforeEach hooks run for describes too when it should only for it tests #1008
Open
3 tasks done
Labels
bug
something not go good
Is there an existing issue for this?
Have you read the
CONTRIBUTING
guide on posting bugs, andCODE_OF_CONDUCT
?This issue exists in the latest tap version
Description
In previous versions, nested
describe
scopes would trigger outer beforeEach/afterEach hooks only around the innerit
tests. In 18 however it seems to also trigger around thedescribe
calls itself, which results in some very strange issues when used with libraries like sinon where you would typically apply a stub in thebeforeEach
and restore it in theafterEach
. The way it works now though, the hook will run an additional time on nested tests and then crash because it's trying to reapply patches that are already applied.Reproduction
Expected output:
Actual Output:
Environment
The text was updated successfully, but these errors were encountered: