Skip to content

Commit 10aee10

Browse files
danbevaddaleax
authored andcommitted
test: check zlib version for createDeflateRaw
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt PR-URL: #13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 0d3b52e commit 10aee10

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/parallel/test-zlib-failed-init.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ const assert = require('assert');
66
const zlib = require('zlib');
77

88
// For raw deflate encoding, requests for 256-byte windows are rejected as
9-
// invalid by zlib.
10-
// (http://zlib.net/manual.html#Advanced)
11-
assert.throws(() => {
12-
zlib.createDeflateRaw({ windowBits: 8 });
13-
}, /^Error: Init error$/);
9+
// invalid by zlib (http://zlib.net/manual.html#Advanced).
10+
// This check was introduced in version 1.2.9 and prior to that there was
11+
// no such rejection which is the reason for the version check below
12+
// (http://zlib.net/ChangeLog.txt).
13+
if (!/^1\.2\.[0-8]$/.test(process.versions.zlib)) {
14+
assert.throws(() => {
15+
zlib.createDeflateRaw({ windowBits: 8 });
16+
}, /^Error: Init error$/);
17+
}
1418

1519
// Regression tests for bugs in the validation logic.
1620

0 commit comments

Comments
 (0)