Skip to content

Commit

Permalink
Skip invalid type write test on Node.js v9
Browse files Browse the repository at this point in the history
Calling .write with an invalid type in objectMode causes an assertion
failure on Node.js v9 due to nodejs/node#16960.  Skip this test on
Node.js v9.  (Note: May be able to selectively re-enable if the fix gets
backported.)

Fixes: #19

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
  • Loading branch information
kevinoid committed Nov 19, 2017
1 parent 03fbd65 commit 50b5491
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions test/inflate-auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,26 +534,30 @@ function defineFormatTests(format) {
}

// For objectMode: true validation is done in _transform. Check we match.
it('errors on write of invalid type', function() {
var options = {objectMode: true};
var zlibStream = new Decompress(options);
var inflateAuto = new InflateAuto(options);
var compareOptions = extend({}, COMPARE_OPTIONS);
compareOptions.endEvents = ['end'];

// nodejs/node@b514bd231 (Node 8) changed Error to TypeError.
if (nodeVersion[0] < 8) {
compareOptions.compare = compareNoErrorTypes;
}
// This causes an assertion failure on Node v9. Skip test on this version.
// See https://github.com/nodejs/node/pull/16960
if (nodeVersion[0] !== 9) {
it('errors on write of invalid type', function() {
var options = {objectMode: true};
var zlibStream = new Decompress(options);
var inflateAuto = new InflateAuto(options);
var compareOptions = extend({}, COMPARE_OPTIONS);
compareOptions.endEvents = ['end'];

var result = streamCompare(inflateAuto, zlibStream, compareOptions);
zlibStream.write(true);
inflateAuto.write(true);
zlibStream.end(compressed);
inflateAuto.end(compressed);
result.checkpoint();
return result;
});
// nodejs/node@b514bd231 (Node 8) changed Error to TypeError.
if (nodeVersion[0] < 8) {
compareOptions.compare = compareNoErrorTypes;
}

var result = streamCompare(inflateAuto, zlibStream, compareOptions);
zlibStream.write(true);
inflateAuto.write(true);
zlibStream.end(compressed);
inflateAuto.end(compressed);
result.checkpoint();
return result;
});
}

if (zlib.inflateSync) {
describe('.inflateAutoSync()', function() {
Expand Down

0 comments on commit 50b5491

Please sign in to comment.