Skip to content
Myr

tests: run mocha with --no-exit to detect hangs

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

closes #3439

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent e3f7f51 · Browse files · 4 files+30 added−21 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+30 added−21 removed

  • tests:+26 added−17 removed
  • other:+4 added−4 removed

4 files+30 added−21 removed

modified:test/middleware.basic.js+1 added-1 removed
modified:test/res.format.js+7 added-4 removed
12var after = require('after')3var express = require('../')4 , request = require('supertest')5 , assert = require('assert');6
161 unmodified lines
168 .expect('Content-Type', 'text/plain; charset=utf-8')169 .expect('hey', done);170 })171171 it('should set the correct charset for the Content-Type', function() {172 it('should set the correct charset for the Content-Type', function (done) {173 var cb = after(3, done)174175 request(app)176 .get('/')177 .set('Accept', 'text/html')175 .expect('Content-Type', 'text/html; charset=utf-8');178 .expect('Content-Type', 'text/html; charset=utf-8', cb)179180 request(app)181 .get('/')182 .set('Accept', 'text/plain')180 .expect('Content-Type', 'text/plain; charset=utf-8');183 .expect('Content-Type', 'text/plain; charset=utf-8', cb)184185 request(app)186 .get('/')187 .set('Accept', 'application/json')185 .expect('Content-Type', 'application/json');188 .expect('Content-Type', 'application/json; charset=utf-8', cb)189 })190191 it('should Vary: Accept', function(done){192 request(app)
23 unmodified lines
modified:test/res.sendFile.js+18 added-12 removed
100 unmodified lines
101102 app.use(function (req, res) {103 setImmediate(function () {104 res.sendFile(path.resolve(fixtures, 'name.txt'));105 cb();105 server.close(cb)106 });107 test.abort();108 });109
1 unmodified line
111 err.code.should.be.empty()112 cb();113 });114115 var test = request(app).get('/');115 var server = app.listen()116 var test = request(server).get('/')117 test.expect(200, cb);118 })119120 describe('with "cacheControl" option', function () {
143 unmodified lines
264 setImmediate(function () {265 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {266 should(err).be.ok()267 err.code.should.equal('ECONNABORTED');267 cb();268 server.close(cb)269 });270 });271 test.abort();272 });273273 var test = request(app).get('/');274 var server = app.listen()275 var test = request(server).get('/')276 test.expect(200, cb);277 })278279 it('should invoke the callback when client already aborted', function (done) {
4 unmodified lines
284 onFinished(res, function () {285 res.sendFile(path.resolve(fixtures, 'name.txt'), function (err) {286 should(err).be.ok()287 err.code.should.equal('ECONNABORTED');286 cb();288 server.close(cb)289 });290 });291 test.abort();292 });293292 var test = request(app).get('/');294 var server = app.listen()295 var test = request(server).get('/')296 test.expect(200, cb);297 })298299 it('should invoke the callback without error when HEAD', function (done) {
90 unmodified lines
390 setImmediate(function () {391 res.sendfile('test/fixtures/name.txt', function (err) {392 should(err).be.ok()393 err.code.should.equal('ECONNABORTED');391 cb();394 server.close(cb)395 });396 });397 test.abort();398 });399397 var test = request(app).get('/');400 var server = app.listen()401 var test = request(server).get('/')402 test.expect(200, cb);403 })404405 it('should invoke the callback when client already aborted', function (done) {
4 unmodified lines
410 onFinished(res, function () {411 res.sendfile('test/fixtures/name.txt', function (err) {412 should(err).be.ok()413 err.code.should.equal('ECONNABORTED');410 cb();414 server.close(cb)415 });416 });417 test.abort();418 });419416 var test = request(app).get('/');420 var server = app.listen()421 var test = request(server).get('/')422 test.expect(200, cb);423 })424425 it('should invoke the callback without error when HEAD', function (done) {
207 unmodified lines
633634 app.use(function (req, res) {635 setImmediate(function () {636 res.sendfile(path.resolve(fixtures, 'name.txt'));632 cb();637 server.close(cb)638 });639 test.abort();640 });641
1 unmodified line
643 err.code.should.be.empty()644 cb();645 });646642 var test = request(app).get('/');647 var server = app.listen()648 var test = request(server).get('/')649 test.expect(200, cb);650 })651652 describe('with an absolute path', function(){
143 unmodified lines
modified:package.json+4 added-4 removed