Comments (2)
Update for mocha 7:
--- a/test/test.js
+++ b/test/test.js
@@ -20,6 +20,7 @@
.get('/')
.set('Host', 'tobi.com')
.expect(200, 'tobi', done)
+ closeApp(app)
})
it('should ignore port in Host', function(done){
@@ -31,6 +32,7 @@
.get('/')
.set('Host', 'tobi.com:8080')
.expect(200, 'tobi', done)
+ closeApp(app)
})
it('should support IPv6 literal in Host', function(done){
@@ -42,6 +44,7 @@
.get('/')
.set('Host', '[::1]:8080')
.expect(200, 'loopback', done)
+ closeApp(app)
})
it('should 404 unless matched', function(done){
@@ -59,6 +62,7 @@
.get('/')
.set('Host', 'ferrets.com')
.expect(404, done)
+ closeApp(app)
})
it('should 404 without Host header', function(done){
@@ -76,6 +80,7 @@
.get('/')
.unset('Host')
.expect(404, done)
+ closeApp(app)
})
describe('arguments', function(){
@@ -118,6 +123,7 @@
.get('/')
.set('Host', 'loki.ferrets.com')
.expect(200, 'wildcard!', done)
+ closeApp(app)
})
it('should restrict wildcards to single part', function(done){
@@ -129,6 +135,7 @@
.get('/')
.set('Host', 'foo.loki.ferrets.com')
.expect(404, done)
+ closeApp(app)
})
it('should treat dot as a dot', function(done){
@@ -140,6 +147,7 @@
.get('/')
.set('Host', 'aXb.com')
.expect(404, done)
+ closeApp(app)
})
it('should match entire string', function(done){
@@ -151,6 +159,7 @@
.get('/')
.set('Host', 'foo.com')
.expect(404, done)
+ closeApp(app)
})
it('should populate req.vhost', function(done){
@@ -164,6 +173,7 @@
.get('/')
.set('Host', 'user-bob.foo.com:8080')
.expect(200, '[["0","bob"],["1","foo"],["host","user-bob.foo.com:8080"],["hostname","user-bob.foo.com"],["length",2]]', done)
+ closeApp(app)
})
})
@@ -177,6 +187,7 @@
.get('/')
.set('Host', 'toki.com')
.expect(200, 'tobi', done)
+ closeApp(app)
})
it('should match entire hostname', function(done){
@@ -194,6 +205,7 @@
.get('/')
.set('Host', 'loki.tobi.com')
.expect(404, done)
+ closeApp(app)
})
it('should populate req.vhost', function(done){
@@ -207,10 +219,18 @@
.get('/')
.set('Host', 'user-bob.foo.com:8080')
.expect(200, '[["0","bob"],["1","foo"],["host","user-bob.foo.com:8080"],["hostname","user-bob.foo.com"],["length",2]]', done)
+ closeApp(app)
})
})
})
+function closeApp(app) {
+ var close = function() {
+ app.close()
+ }
+ setTimeout(close,2000)
+}
+
function createServer(hostname, server) {
var vhosts = !Array.isArray(hostname)
? [vhost(hostname, server)]
from vhost.
Hi, thanks for the report! I just ran the test suite, including updating to mocha@7 and the test suite ran without issue. The supertest
library, when given a reference to an app
where app
is not already listening, will start the server and automatically close it after the tests.
If you believe there is an issue, you're always welcome to open a pull request 👍 but I was not able to reproduce any issue with the information provided here.
from vhost.
Related Issues (16)
- vhost for other web frameworks. HOT 6
- expose private functions? HOT 4
- vhost routes never get hit when ports are mentioned. HOT 15
- Subdomains in localhost HOT 1
- Removing vhosts HOT 7
- Using express vhost behind a reverse proxy HOT 3
- vhost on Firebase Functions HOT 1
- each vhost https support HOT 2
- vhost for multiple domain HOT 2
- Same target vhost but different callback HOT 1
- Issues with SEO HOT 6
- req.vhost is undefined HOT 6
- How to have *.domain.com and domain.com work together? HOT 2
- HTTPS Server HOT 1
- Vhost's ending in wildcard do not match. Version 3.0.2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vhost.