Closed CodeIter closed 5 years ago
✨ Good work on this PR so far! ✨ Unfortunately, the Travis CI build is failing as of 83d050d9c71083ae992cd6ed46c9cf78b3e8f238. Here's the output:
npm test
> shrink-ray-current@4.0.0 test /home/travis/build/Alorel/shrink-ray
> nyc mocha --check-leaks --bail
compression()
✓ should skip HEAD
✓ should skip unknown accept-encoding
✓ should skip if content-encoding already set
✓ should set Vary
✓ should set Vary even if Accept-Encoding is not set
✓ should not set Vary if Content-Type does not pass filter
✓ should set Vary for HEAD request
✓ should transfer chunked
✓ should remove Content-Length for chunked
✓ should work with encoding arguments
✓ should allow writing after close
✓ should back-pressure when compressed
✓ should back-pressure when uncompressed
✓ should transfer large bodies
✓ should transfer large bodies with multiple writes
threshold
✓ should not compress responses below the threshold size
✓ should compress responses above the threshold size
✓ should compress when streaming without a content-length
✓ should not compress when streaming and content-length is lower than threshold
✓ should compress when streaming and content-length is larger than threshold
✓ should handle writing hex data
✓ should consider res.end() as 0 length
✓ should work with res.end(null)
when "Accept-Encoding: gzip"
✓ should respond with gzip
✓ should return false writing after end
when "Accept-Encoding: deflate"
✓ should respond with deflate
when "Accept-Encoding: gzip, deflate"
✓ should respond with gzip
when "Accept-Encoding: deflate, gzip"
✓ should respond with gzip
when "Accept-Encoding: deflate, gzip, br"
✓ should respond with brotli
✓ should respond with gzip for server-sent events (SSE)
when "Accept-Encoding: br"
✓ should respond with brotli
✓ should have a correctly encoded brotli response
✓ should apply the brotli parameters from options
when caching is turned on
1) should cache a gzipped response with the same ETag
33 passing (192ms)
1 failing
1) compression()
when caching is turned on
should cache a gzipped response with the same ETag:
Uncaught ReferenceError: zopfli is not defined
at getBestQualityReencoder (index.js:88:202)
at Object.add (index.js:84:117)
at Gzip.<anonymous> (index.js:62:337)
at endReadableNT (_stream_readable.js:1183:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
/home/travis/build/Alorel/shrink-ray/node_modules/mocha/lib/runner.js:656
var retry = test.currentRetry();
^
TypeError: Cannot read property 'currentRetry' of undefined
at /home/travis/build/Alorel/shrink-ray/node_modules/mocha/lib/runner.js:656:28
at done (/home/travis/build/Alorel/shrink-ray/node_modules/mocha/lib/runnable.js:334:5)
at Test.<anonymous> (/home/travis/build/Alorel/shrink-ray/node_modules/mocha/lib/runnable.js:435:7)
at Test.assert (/home/travis/build/Alorel/shrink-ray/node_modules/supertest/lib/test.js:181:6)
at Server.localAssert (/home/travis/build/Alorel/shrink-ray/node_modules/supertest/lib/test.js:131:12)
at Object.onceWrapper (events.js:299:28)
at Server.emit (events.js:210:5)
at emitCloseNT (net.js:1642:8)
at processTicksAndRejections (internal/process/task_queues.js:79:21)
------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
------------------|----------|----------|----------|----------|-------------------|
All files | 86.96 | 83.94 | 82.5 | 87.17 | |
brotli-compat.js | 68.42 | 50 | 80 | 72.22 | 39,47,48,50,61 |
index.js | 89.71 | 86.05 | 82.35 | 89.55 |... 65,504,505,507 |
zopfli-compat.js | 57.14 | 50 | 100 | 57.14 | 5,10,19 |
------------------|----------|----------|----------|----------|-------------------|
=============================== Coverage summary ===============================
Statements : 86.96% ( 200/230 )
Branches : 83.94% ( 115/137 )
Functions : 82.5% ( 33/40 )
Lines : 87.17% ( 197/226 )
================================================================================
I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!
🤕
at least travis passed
Thanks! :)
Thanks @CodeIter and @Alorel 👍
implement @keeganstreet 's solution for issue Alorel/shrink-ray#39 Hope it help