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
Provenance
- Commit
de129c2- Tree
8a35d90- Author
Douglas Christopher Wilson <doug@somethingdoug.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
e3f7f51
4 files changed+30 added−21 removed
modified:test/middleware.basic.js+1 added-1 removed
26 unmodified lines272829303131323334354 unmodified lines26 unmodified lines res.end(buf); }); });
request(app.listen()) request(app) .get('/') .set('Content-Type', 'application/json') .send('{"foo":"bar"}') .expect('Content-Type', 'application/json')4 unmodified linesmodified:test/res.format.js+7 added-4 removed
1 2+var after = require('after')3 var express = require('../')4 , request = require('supertest')5 , assert = require('assert');6 161 unmodified lines168 .expect('Content-Type', 'text/plain; charset=utf-8')169 .expect('hey', done);170 })171 171- 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)174+175 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)179 180 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)184 185 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 })190 191 it('should Vary: Accept', function(done){192 request(app)23 unmodified linesmodified:test/res.sendFile.js+18 added-12 removed
100 unmodified lines101 102 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 line111 err.code.should.be.empty()112 cb();113 });114 115- var test = request(app).get('/');115+ var server = app.listen()116+ var test = request(server).get('/')117 test.expect(200, cb);118 })119 120 describe('with "cacheControl" option', function () {143 unmodified lines264 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 });273 273- var test = request(app).get('/');274+ var server = app.listen()275+ var test = request(server).get('/')276 test.expect(200, cb);277 })278 279 it('should invoke the callback when client already aborted', function (done) {4 unmodified lines284 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 });293 292- var test = request(app).get('/');294+ var server = app.listen()295+ var test = request(server).get('/')296 test.expect(200, cb);297 })298 299 it('should invoke the callback without error when HEAD', function (done) {90 unmodified lines390 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 });399 397- var test = request(app).get('/');400+ var server = app.listen()401+ var test = request(server).get('/')402 test.expect(200, cb);403 })404 405 it('should invoke the callback when client already aborted', function (done) {4 unmodified lines410 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 });419 416- var test = request(app).get('/');420+ var server = app.listen()421+ var test = request(server).get('/')422 test.expect(200, cb);423 })424 425 it('should invoke the callback without error when HEAD', function (done) {207 unmodified lines633 634 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 line643 err.code.should.be.empty()644 cb();645 });646 642- var test = request(app).get('/');647+ var server = app.listen()648+ var test = request(server).get('/')649 test.expect(200, cb);650 })651 652 describe('with an absolute path', function(){143 unmodified linesmodified:package.json+4 added-4 removed
88 unmodified lines899091929394959693949596979888 unmodified lines "lib/" ], "scripts": { "lint": "eslint .", "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/", "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/", "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/" "test": "mocha --require test/support/env --reporter spec --bail --check-leaks --no-exit test/ test/acceptance/", "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks --no-exit test/ test/acceptance/", "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks --no-exit test/ test/acceptance/", "test-tap": "mocha --require test/support/env --reporter tap --check-leaks --no-exit test/ test/acceptance/" }}