diff --git a/test/parallel/test-zlib-failed-init.js b/test/parallel/test-zlib-failed-init.js index 3b6da1d4fb840f..4f224ecd616ec7 100644 --- a/test/parallel/test-zlib-failed-init.js +++ b/test/parallel/test-zlib-failed-init.js @@ -6,11 +6,15 @@ const assert = require('assert'); const zlib = require('zlib'); // For raw deflate encoding, requests for 256-byte windows are rejected as -// invalid by zlib. -// (http://zlib.net/manual.html#Advanced) -assert.throws(() => { - zlib.createDeflateRaw({ windowBits: 8 }); -}, /^Error: Init error$/); +// invalid by zlib (http://zlib.net/manual.html#Advanced). +// This check was introduced in version 1.2.9 and prior to that there was +// no such rejection which is the reason for the version check below +// (http://zlib.net/ChangeLog.txt). +if (!/^1\.2\.[0-8]$/.test(process.versions.zlib)) { + assert.throws(() => { + zlib.createDeflateRaw({ windowBits: 8 }); + }, /^Error: Init error$/); +} // Regression tests for bugs in the validation logic.