Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v13.x backport] zlib: align with streams #32371

Closed
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
4 changes: 1 addition & 3 deletions test/parallel/test-zlib-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const zlib = require('zlib');
ts.destroy();
assert.strictEqual(ts._handle, null);

ts.on('close', common.mustCall(() => {
ts.close(common.mustCall());
}));
ts.on('close', common.mustCall());
Copy link
Member Author

@ronag ronag Mar 19, 2020

Choose a reason for hiding this comment

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

finished does not invoke callback on closed stream, this was a semver-major fix does not land on 13

}

{
Expand Down
10 changes: 6 additions & 4 deletions test/parallel/test-zlib-object-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const assert = require('assert');
const { Gunzip } = require('zlib');

const gunzip = new Gunzip({ objectMode: true });
assert.throws(
() => gunzip.write({}),
TypeError
);
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a little unsure how exactly this could throw before.

gunzip.write({}, (err) => {
assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE');
});
gunzip.on('error', (err) => {
assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE');
});
11 changes: 3 additions & 8 deletions test/parallel/test-zlib-write-after-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ const zlib = require('zlib');
zlib.gzip('hello', common.mustCall(function(err, out) {
const unzip = zlib.createGunzip();
unzip.close(common.mustCall());
assert.throws(
() => unzip.write(out),
{
code: 'ERR_STREAM_DESTROYED',
name: 'Error',
message: 'Cannot call write after a stream was destroyed'
}
);
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a little unsure how exactly this could throw before.

unzip.write(out, (err) => {
assert.strict(err.code, 'ERR_STREAM_DESTROYED');
});
}));