Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: fix test-eventtarget
  • Loading branch information
lundibundi committed May 31, 2020
commit fdb470157f9896b8cf3d3725642791c2c831ca36
20 changes: 2 additions & 18 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
throws,
} = require('assert');

const { once, on } = require('events');
const { once } = require('events');

// The globals are defined.
ok(Event);
Expand Down Expand Up @@ -435,7 +435,7 @@ ok(EventTarget);
{
const target = new EventTarget();
strictEqual(target.toString(), '[object EventTarget]');
const event = new Event();
const event = new Event('foo');
strictEqual(event.toString(), '[object Event]');
}
{
Expand All @@ -452,19 +452,3 @@ ok(EventTarget);
target.addEventListener('__proto__', fn);
target.dispatchEvent(ev);
}

(async () => {
// test NodeEventTarget async-iterability
const emitter = new NodeEventTarget();
const event = new Event('foo');
const interval = setInterval(() => emitter.dispatchEvent(event), 0);
let count = 0;
for await (const [ item ] of on(emitter, 'foo')) {
count++;
strictEqual(item.type, 'foo');
if (count > 5) {
break;
}
}
clearInterval(interval);
})().then(common.mustCall());