Skip to content

Commit

Permalink
WIP test all node.js unpipe
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jul 16, 2020
1 parent 858d332 commit c2cdb03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"eslint-plugin-standard": "4.0.0",
"istanbul": "0.4.5",
"mocha": "6.0.2",
"supertest": "4.0.0"
"supertest": "4.0.0",
"unpipe": "1.0.0"
},
"files": [
"LICENSE",
Expand Down
9 changes: 2 additions & 7 deletions test/compression.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var bytes = require('bytes')
var crypto = require('crypto')
var http = require('http')
var request = require('supertest')
var unpipe = require('unpipe')
var zlib = require('zlib')

var compression = require('..')
Expand Down Expand Up @@ -456,12 +457,6 @@ describe('compression()', function () {
})

it('should not leak event listeners when res.unpipe() is used (#135)', function (done) {
// unpipe and stream.Readable were added in v0.9.4
var stream = require('stream')
if (!(stream.Readable && stream.Readable.prototype.unpipe)) {
this.skip()
}

var hasWarned = false
var onWarning = function () {
hasWarned = true
Expand All @@ -471,7 +466,7 @@ describe('compression()', function () {
var int = setInterval(function () {
var rs = require('fs').createReadStream('does not exist')
rs.on('error', function (e) {
rs.unpipe(res)
unpipe(rs)
})
rs.pipe(res)
if (times++ > res.getMaxListeners()) {
Expand Down

0 comments on commit c2cdb03

Please sign in to comment.