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

Fix broken tests { level: 0 } #107

Open
puzrin opened this issue Jul 20, 2017 · 5 comments
Open

Fix broken tests { level: 0 } #107

puzrin opened this issue Jul 20, 2017 · 5 comments

Comments

@puzrin
Copy link
Member

puzrin commented Jul 20, 2017

nodejs/node#10980

After node upgraded zlib 1.2.8 -> 1.2.11, 2 tests become broken.

@puzrin
Copy link
Member Author

puzrin commented Jul 21, 2017

Also, test helper probably should align OS codes (for gzip) before compare nodejs/node#10980 (comment). That does not make sense now, but may be useful for others.

@puzrin
Copy link
Member Author

puzrin commented Jul 21, 2017

UPD: it seems that zlib 1.2.11 really changed deflate stored binary representation

const pako    = require('pako');
const zlib    = require('zlib');
const fs      = require('fs');
const assert  = require('assert');
const join    = require('path').join;


const len100k = new Uint8Array(fs.readFileSync(join(__dirname, 'fixtures/lorem_en_100k.txt')));


describe('deflate level 0 checks', function () {

  it('pako deflate -> pako inflate', function () {
    assert.deepEqual(
      pako.inflate(pako.deflate(len100k, { level: 0 })),
      len100k
    );
  });

  it('zlib deflate -> zlib inflate', function () {
    assert.deepEqual(
      zlib.inflateSync(zlib.deflateSync(Buffer.from(len100k), { level: 0 })),
      len100k
    );
  });

  it('zlib deflate -> pako inflate', function () {
    assert.deepEqual(
      pako.inflate(zlib.deflateSync(Buffer.from(len100k), { level: 0 })),
      len100k
    );
  });

  it('zlib deflate vs pako deflate', function () {
    assert.deepEqual(
      zlib.deflateSync(Buffer.from(len100k), { level: 0 }),
      pako.deflate(len100k, { level: 0 })
    );
  });

});

@rbuels
Copy link

rbuels commented Sep 1, 2018

@puzrin is this still an issue, or was it fixed by your f5f5fea?

@puzrin
Copy link
Member Author

puzrin commented Sep 1, 2018

@rbuels just remove those lines and you will see.

@puzrin
Copy link
Member Author

puzrin commented Sep 1, 2018

Ups... sorry, wrong comment. Yes, that's still an issue. But it's better so solve it as part of resync with upstream. That's a separate task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants