mirror of
https://github.com/expressjs/express.git
synced 2026-02-21 19:41:36 +00:00
call callback once on listen error
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
var express = require('../')
|
||||
var assert = require('assert')
|
||||
|
||||
describe('app.listen()', function(){
|
||||
it('should wrap with an HTTP server', function(done){
|
||||
@@ -10,4 +11,17 @@ describe('app.listen()', function(){
|
||||
server.close(done)
|
||||
});
|
||||
})
|
||||
it('should callback on HTTP server errors', function (done) {
|
||||
var app1 = express()
|
||||
var app2 = express()
|
||||
|
||||
var server1 = app1.listen(0, function (err) {
|
||||
assert(!err)
|
||||
app2.listen(server1.address().port, function (err) {
|
||||
assert(err.code === 'EADDRINUSE')
|
||||
server1.close()
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user