Skip to content
Myr

build: supertest@6.2.2

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 43cc56e · Browse files · 4 files+52 added−33 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+52 added−33 removed

  • tests:+46 added−30 removed
  • other:+6 added−3 removed

4 files+52 added−33 removed

modified:.github/workflows/ci.yml+2 added-2 removed
modified:test/res.sendFile.js+46 added-30 removed
110 unmodified lines
111112 app.use(function (req, res) {113 setImmediate(function () {114 res.sendFile(path.resolve(fixtures, 'name.txt'));115 server.close(cb)115 setTimeout(function () {116 cb(error)117 }, 10)118 })120 test.abort();119 test.req.abort()120 });121122 app.use(function (err, req, res, next) {123 error = err
1 unmodified line
125 });126127 var server = app.listen()128 var test = request(server).get('/')130 test.end()129 test.end(function (err) {130 assert.ok(err)131 server.close(cb)132 })133 })134135 describe('with "cacheControl" option', function () {136 it('should enable cacheControl by default', function (done) {
136 unmodified lines
273 .expect(200, cb);274 })275276 it('should invoke the callback when client aborts', function (done) {275 var cb = after(1, done);277 var cb = after(2, done)278 var app = express();279280 app.use(function (req, res) {281 setImmediate(function () {282 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {281 should(err).be.ok()282 err.code.should.equal('ECONNABORTED');283 server.close(cb)283 assert.ok(err)284 assert.strictEqual(err.code, 'ECONNABORTED')285 cb()286 });287 });286 test.abort();288 test.req.abort()289 });290291 var server = app.listen()292 var test = request(server).get('/')291 test.expect(200, cb);293 test.end(function (err) {294 assert.ok(err)295 server.close(cb)296 })297 })298299 it('should invoke the callback when client already aborted', function (done) {295 var cb = after(1, done);300 var cb = after(2, done)301 var app = express();302303 app.use(function (req, res) {304 onFinished(res, function () {305 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {301 should(err).be.ok()302 err.code.should.equal('ECONNABORTED');303 server.close(cb)306 assert.ok(err)307 assert.strictEqual(err.code, 'ECONNABORTED')308 cb()309 });310 });306 test.abort();311 test.req.abort()312 });313314 var server = app.listen()315 var test = request(server).get('/')311 test.expect(200, cb);316 test.end(function (err) {317 assert.ok(err)318 server.close(cb)319 })320 })321322 it('should invoke the callback without error when HEAD', function (done) {323 var app = express();
81 unmodified lines
405 .end(done);406 })407408 it('should invoke the callback when client aborts', function (done) {401 var cb = after(1, done);409 var cb = after(2, done)410 var app = express();411412 app.use(function (req, res) {413 setImmediate(function () {414 res.sendfile('test/fixtures/name.txt', function (err) {407 should(err).be.ok()408 err.code.should.equal('ECONNABORTED');409 server.close(cb)415 assert.ok(err)416 assert.strictEqual(err.code, 'ECONNABORTED')417 cb()418 });419 });412 test.abort();420 test.req.abort()421 });422423 var server = app.listen()424 var test = request(server).get('/')417 test.expect(200, cb);425 test.end(function (err) {426 assert.ok(err)427 server.close(cb)428 })429 })430431 it('should invoke the callback when client already aborted', function (done) {421 var cb = after(1, done);432 var cb = after(2, done)433 var app = express();434435 app.use(function (req, res) {436 onFinished(res, function () {437 res.sendfile('test/fixtures/name.txt', function (err) {427 should(err).be.ok()428 err.code.should.equal('ECONNABORTED');429 server.close(cb)438 assert.ok(err)439 assert.strictEqual(err.code, 'ECONNABORTED')440 cb()441 });442 });432 test.abort();443 test.req.abort()444 });445446 var server = app.listen()447 var test = request(server).get('/')437 test.expect(200, cb);448 test.end(function (err) {449 assert.ok(err)450 server.close(cb)451 })452 })453454 it('should invoke the callback without error when HEAD', function (done) {455 var app = express();
209 unmodified lines
665666 app.use(function (req, res) {667 setImmediate(function () {668 res.sendfile(path.resolve(fixtures, 'name.txt'));655 server.close(cb)669 setTimeout(function () {670 cb(error)671 }, 10)672 });660 test.abort();673 test.req.abort()674 });675676 app.use(function (err, req, res, next) {677 error = err
1 unmodified line
679 });680681 var server = app.listen()682 var test = request(server).get('/')670 test.end()683 test.end(function (err) {684 assert.ok(err)685 server.close(cb)686 })687 })688689 describe('with an absolute path', function(){690 it('should transfer the file', function(done){
152 unmodified lines
modified:appveyor.yml+3 added
56 unmodified lines
57 - ps: |58 # supertest for http calls59 # - use 2.0.0 for Node.js < 460 # - use 3.4.2 for Node.js < 661 # - use 6.1.6 for Node.js < 862 if ([int]$env:nodejs_version.split(".")[0] -lt 4) {63 npm install --silent --save-dev supertest@2.0.064 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 6) {65 npm install --silent --save-dev supertest@3.4.266 } elseif ([int]$env:nodejs_version.split(".")[0] -lt 8) {67 npm install --silent --save-dev supertest@6.1.668 }69 # Update Node.js modules70 - ps: |71 # Prune & rebuild node_modules
15 unmodified lines
modified:package.json+1 added-1 removed
74 unmodified lines
75 "morgan": "1.10.0",76 "multiparty": "4.2.2",77 "pbkdf2-password": "1.2.1",78 "should": "13.2.3",79 "supertest": "6.1.6",79 "supertest": "6.2.2",80 "vhost": "~3.0.2"81 },82 "engines": {83 "node": ">= 0.10.0"
16 unmodified lines