Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "tv", | ||
"description": "Interactive debug console plugin for hapi", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Eran Hammer <eran@hueniverse.com> (http://hueniverse.com)", | ||
@@ -21,3 +21,3 @@ "contributors":[ | ||
"engines": { | ||
"node": "0.10.x" | ||
"node": ">=0.10.22" | ||
}, | ||
@@ -30,6 +30,6 @@ "dependencies": { | ||
"peerDependencies": { | ||
"hapi": "2.x.x" | ||
"hapi": ">=2.x.x" | ||
}, | ||
"devDependencies": { | ||
"hapi": "2.x.x", | ||
"hapi": "3.x.x", | ||
"lab": "1.x.x" | ||
@@ -36,0 +36,0 @@ }, |
@@ -17,4 +17,3 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a> | ||
var options = { | ||
webSocketPort: 3000, | ||
debugEndpoint: '/debug/console', | ||
endpoint: '/debug/console', | ||
queryKey: 'debug' | ||
@@ -38,4 +37,7 @@ }; | ||
- `websocketPort` - the port used by the WebSocket connection. Defaults to _3000_. | ||
- `debugEndpoint` - the debug console request path added to the server routes. Defaults to _'/debug/console'_. | ||
- `host` - the hostname, IP address, or path to UNIX domain socket the WebSocket connection is bound to. Defaults to _undefined_ and therefore `0.0.0.0` | ||
which means any available network interface(see hapi `new Server()`). | ||
- `port` - the port used by the WebSocket connection. Defaults to _0_ and therefore an ephemeral port (see hapi `new Server()`). | ||
- `endpoint` - the debug console request path added to the server routes. Defaults to _'/debug/console'_. | ||
- `queryKey` - the name or the request query parameter used to mark requests being debugged. Defaults to _debug_. | ||
- `template` - the name of the template to use for the debug console. Defaults to _index_. |
@@ -24,12 +24,6 @@ // Load modules | ||
var server = null; | ||
it('reports a request event', function (done) { | ||
before(function (done) { | ||
var server = new Hapi.Server(0); | ||
var options = { | ||
port: 0 | ||
}; | ||
server = new Hapi.Server(0); | ||
server.route({ | ||
@@ -44,39 +38,55 @@ method: 'GET', | ||
server.pack.require('../', options, function (err) { | ||
server.pack.require('../', { port: 0 }, function (err) { | ||
expect(err).to.not.exist; | ||
done(); | ||
}); | ||
}); | ||
it('reports a request event', function (done) { | ||
server.inject('/debug/console', function (res) { | ||
server.inject('/debug/console', function (res) { | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.contain('Debug Console'); | ||
expect(res.statusCode).to.equal(200); | ||
expect(res.result).to.contain('Debug Console'); | ||
var host = res.result.match(/var host = '([^']+)'/)[1]; | ||
var port = res.result.match(/var port = (\d+)/)[1]; | ||
var ws = new Ws('ws://' + host + ':' + port); | ||
var host = res.result.match(/var host = '([^']+)'/)[1]; | ||
var port = res.result.match(/var port = (\d+)/)[1]; | ||
var ws = new Ws('ws://' + host + ':' + port); | ||
ws.once('open', function () { | ||
ws.once('open', function () { | ||
ws.send('*'); | ||
ws.send('*'); | ||
setTimeout(function () { | ||
setTimeout(function () { | ||
server.inject('/?debug=123', function (res) { | ||
server.inject('/?debug=123', function (res) { | ||
expect(res.result).to.equal('1'); | ||
}); | ||
}, 100); | ||
}); | ||
expect(res.result).to.equal('1'); | ||
}); | ||
}, 100); | ||
ws.once('message', function (data, flags) { | ||
expect(JSON.parse(data).data.agent).to.equal('shot'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
ws.once('message', function (data, flags) { | ||
it('uses specified hostname', function (done) { | ||
expect(JSON.parse(data).data.agent).to.equal('shot'); | ||
done(); | ||
}); | ||
var server = new Hapi.Server(0); | ||
server.route({ | ||
method: 'GET', | ||
path: '/', | ||
handler: function (request, reply) { | ||
reply('1'); | ||
} | ||
}); | ||
server.pack.require('../', { host: '127.0.0.1', port: 0 }, function (err) { | ||
expect(err).to.not.exist; | ||
done(); | ||
}); | ||
}); | ||
@@ -83,0 +93,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
534885
12563
42