Skip to content
Closed
Show file tree
Hide file tree
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
fixup! lint
  • Loading branch information
benjamingr committed Jun 6, 2020
commit e985ec7f1fea183b56fa23225a921bdd037f72d8
2 changes: 1 addition & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class EventTarget {
// No error code for this since it is a Warning
// eslint-disable-next-line no-restricted-syntax
const w = new Error(`addEventListener called with ${listener}` +
` which has no effect.`);
' which has no effect.');
w.name = 'AddEventListenerArgumentTypeWarning';
w.target = this;
w.type = type;
Expand Down
8 changes: 5 additions & 3 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ process.on('warning', (e) => {

// Utility promise for parts of the test that need to wait for eachother -
// Namely tests for warning events
/* eslint-disable no-unused-vars */
let asyncTest = Promise.resolve();

// First, test Event
Expand Down Expand Up @@ -389,14 +390,15 @@ let asyncTest = Promise.resolve();
target.on('foo', () => {});
target.on('foo', () => {});

// warnings are always emitted asynchronously so wait for a tick
await delay(0)
// Warnings are always emitted asynchronously so wait for a tick
await delay(0);
ok(lastWarning instanceof Error);
strictEqual(lastWarning.name, 'MaxListenersExceededWarning');
strictEqual(lastWarning.target, target);
strictEqual(lastWarning.count, 2);
strictEqual(lastWarning.type, 'foo');
ok(lastWarning.message.includes('2 foo listeners added to NodeEventTarget'));
const warning = '2 foo listeners added to NodeEventTarget';
ok(lastWarning.message.includes(warning));
}).then(common.mustCall());
}

Expand Down