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
Next Next commit
Fix lint
  • Loading branch information
陈刚 committed Jan 20, 2018
commit 8da1b7288f65384afafd475a5a19e1ca589e4505
12 changes: 7 additions & 5 deletions test/parallel/test-stream-pipe-unpipe-streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ source.unpipe(dest1);
assert.strictEqual(source._readableState.pipes, null);

{
// test `cleanup()` if we unpipe all streams.
// test `cleanup()` if we unpipe all streams.
const source = Readable({ read: () => {} });
const dest1 = Writable({ write: () => {} });
const dest2 = Writable({ write: () => {} });
Expand All @@ -47,7 +47,7 @@ assert.strictEqual(source._readableState.pipes, null);
assert.strictEqual(source._readableState.pipesCount, 0);
assert.strictEqual(source._readableState.flowing, false);

srcCheckEventNames.forEach(eventName => {
srcCheckEventNames.forEach((eventName) => {
assert.strictEqual(
source.listenerCount(eventName), 0,
`source's '${eventName}' event listeners don't be cleaned up`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: replace "don't be cleaned up" with "not removed", same below.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok~

Expand All @@ -62,13 +62,15 @@ assert.strictEqual(source._readableState.pipes, null);
const unpipeChecker = common.mustCall(() => {
assert.strictEqual(
dest.listenerCount('unpipe'), 1,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd simplify this as

assert.deepStrictEqual(dest.listeners('unpipe'), [unpipeChecker]);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok~

`destination{${currentDestId}} should have a 'unpipe' event listener which is \`unpipeChecker\``
`destination{${currentDestId}} should have a 'unpipe' event ` +
'listener which is `unpipeChecker`'
);
dest.removeListener('unpipe', unpipeChecker);
destCheckEventNames.forEach(eventName => {
destCheckEventNames.forEach((eventName) => {
assert.strictEqual(
dest.listenerCount(eventName), 0,
`destination{${currentDestId}}'s '${eventName}' event listeners don't be cleaned up`
`destination{${currentDestId}}'s '${eventName}' event ` +
"listeners don't be cleaned up"
);
});

Expand Down