MaxListenersExceededWarning when using beforeEach
or afterEach
in test runner tests
#49304
Labels
test_runner
Issues and PRs related to the test runner subsystem.
Version
20.4.0
Platform
Linux ubuntu.wsl2 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
test runner
What steps will reproduce the bug?
Running this code will cause two warnings (one each for
beforeEach
andafterEach
)How often does it reproduce? Is there a required condition?
Anytime you've started more than 10 tests in a test suite using either/both
beforeEach
/afterEach
What is the expected behavior? Why is that the expected behavior?
No warnings? I would've assumed any listeners should be removed after each test finishes.
What do you see instead?
With
--trace-warnings
, running the above code, I get this error/stacktrace:Additional information
I likely would've noticed this earlier than now, however my test script was using
--no-warnings
because thenode:test
test runner suite was experimental at the time I started building the tests,--no-warnings
wasn't removed from my script once it was markedstable
in20.0.0
yet but was looking deeper into some bugs of my own and ran my tests directly without--no-warnings
and saw this.I haven't tested this issue on
20.5.0
yet but I did do a quick but fruitless search through issues to see if it had been discussed previously.The text was updated successfully, but these errors were encountered: