-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
versions | ||
suites | ||
|
||
# Files ignored by the test suite must be put here so changes are carried over to | ||
# the main repo | ||
!suites/common/index.js | ||
versions |
23 changes: 23 additions & 0 deletions
23
node/testdata/suites/parallel/test-event-emitter-listener-count.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// deno-fmt-ignore-file | ||
// deno-lint-ignore-file | ||
|
||
// Copyright Joyent and Node contributors. All rights reserved. MIT license. | ||
|
||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const EventEmitter = require('events'); | ||
|
||
const emitter = new EventEmitter(); | ||
emitter.on('foo', () => {}); | ||
emitter.on('foo', () => {}); | ||
emitter.on('baz', () => {}); | ||
// Allow any type | ||
emitter.on(123, () => {}); | ||
|
||
assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2); | ||
assert.strictEqual(emitter.listenerCount('foo'), 2); | ||
assert.strictEqual(emitter.listenerCount('bar'), 0); | ||
assert.strictEqual(emitter.listenerCount('baz'), 1); | ||
assert.strictEqual(emitter.listenerCount(123), 1); |