test: fix flaky test-async-wrap-uncaughtexception
It's possible for beforeExit
to be emitted more than once if work is
scheduled by its listeners. Accommodate this fact in the test.
Fixes: https://github.com/nodejs/node/issues/16210
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test async-wrap