test: increase coverage for lib/events.js#9865
Closed
captainsafia wants to merge 3 commits intonodejs:masterfrom
Closed
test: increase coverage for lib/events.js#9865captainsafia wants to merge 3 commits intonodejs:masterfrom
captainsafia wants to merge 3 commits intonodejs:masterfrom
Conversation
This adds tests for the case in which listeners() is invoked on a EventEmitter with no events.
bb6db3d to
6d63d0d
Compare
cjihrig
approved these changes
Dec 1, 2016
Member
Contributor
|
LGTM IF ci is green |
Member
|
Two failed hosts look CI infra related, not related to this test. But because EVERYONE LOVES GREEN, let's try again: https://ci.nodejs.org/job/node-test-pull-request/5037/ |
captainsafia
added a commit
to captainsafia/node
that referenced
this pull request
Dec 1, 2016
In the process of creating nodejs#9865, it was discovered that the code checking whether or not events was defined was unnecessary because the only situation in which events would be undefined is if it is monkeypatched by an external entity. This should be removed in order to discourage this. If the test added in nodejs#9865 is merged, it will need to removed on merge of this commit.
2 tasks
lpinca
approved these changes
Dec 1, 2016
addaleax
approved these changes
Dec 1, 2016
This adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set.
Contributor
Author
|
I added tests for the case explored in #9866 in which |
Member
|
Thanks for adding the additional test! |
Contributor
Author
|
@Trott: Great point! I've update the code. |
Member
Trott
pushed a commit
to Trott/io.js
that referenced
this pull request
Dec 3, 2016
Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: nodejs#9865 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Member
|
Landed in a912b79 |
addaleax
pushed a commit
that referenced
this pull request
Dec 5, 2016
Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: #9865 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
jmdarling
pushed a commit
to jmdarling/node
that referenced
this pull request
Dec 8, 2016
Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: nodejs#9865 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Dec 20, 2016
Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: #9865 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Dec 21, 2016
Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: #9865 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected 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
_eventsto ever beundefined 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._eventstomimic this expected behavior.