test: increase coverage for lib/events.js
Checklist
-
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test, events
Description of change
This adds a test for the case in which listeners() is invoked on an EventEmitter with no events.
Note that the EventEmitter does not allow _events
to ever be
undefined as it is instantiated in the initializer. The only situation in
which it might be undefined is if it is monkey-patched externally.
Because of this, the added tests monkey-patches this._events
to
mimic this expected behavior.