healthchecks
Advanced tools
Comparing version 1.4.3 to 1.4.4
@@ -0,1 +1,6 @@ | ||
## Version 1.4.4 2015-04-16 | ||
CHANGED show response time in seconds, 2 decimal places | ||
## Version 1.4.3 2015-03-27 | ||
@@ -2,0 +7,0 @@ |
@@ -82,2 +82,11 @@ // Exports an Express middleware factory. | ||
// Our Handlerbars instance. | ||
const handlebars = Handlebars.create(); | ||
// Convert milliseconds to seconds formatted n.nn | ||
handlebars.registerHelper('seconds', function(value) { | ||
return (value / 1000).toFixed(2); | ||
}); | ||
// The check function will run all checks in parallel, and resolve to an object | ||
@@ -228,4 +237,3 @@ // with the properties: | ||
const template = File.readFileSync(Path.join(__dirname, '/index.hbs'), 'utf-8'); | ||
Handlebars.registerHelper('ms', ms); | ||
const render = Handlebars.compile(template); | ||
const render = handlebars.compile(template); | ||
@@ -232,0 +240,0 @@ // Return the Express middleware |
{ | ||
"name": "healthchecks", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"scripts": { | ||
@@ -17,5 +17,6 @@ "test": "mocha" | ||
"devDependencies": { | ||
"eslint": "^0.19.0", | ||
"express": "^4.12.3", | ||
"mocha": "^2.2.1", | ||
"zombie": "^3.1.0" | ||
"mocha": "^2.2.4", | ||
"zombie": "^4.0.7" | ||
}, | ||
@@ -22,0 +23,0 @@ "description": "Express middleware that runs health checks on your application", |
const assert = require('assert'); | ||
const healthchecks = require('..'); | ||
const Path = require('path'); | ||
const request = require('request'); | ||
@@ -10,3 +11,4 @@ const server = require('./helpers/server'); | ||
before(function(done) { | ||
server.use('/_healthchecks.empty', healthchecks(__dirname + '/checks/empty')); | ||
const filename = Path.join(__dirname, 'checks/empty'); | ||
server.use('/_healthchecks.empty', healthchecks(filename)); | ||
server.ready(done); | ||
@@ -30,3 +32,4 @@ }); | ||
assert.throws(function() { | ||
server.use('/_healthchecks.invalid', healthchecks(__dirname + '/checks/invalid')); | ||
const filename = Path.join(__dirname, 'checks/invalid'); | ||
server.use('/_healthchecks.invalid', healthchecks(filename)); | ||
}); | ||
@@ -33,0 +36,0 @@ done(); |
@@ -1,3 +0,4 @@ | ||
const express = require('express'); | ||
const healthchecks = require('../..'); | ||
const express = require('express'); | ||
const healthchecks = require('../..'); | ||
const Path = require('path'); | ||
@@ -15,5 +16,5 @@ | ||
server.ready = function(callback) { | ||
if (listening) { | ||
if (listening) | ||
setImmediate(callback); | ||
} else { | ||
else | ||
server.listen(3000, function() { | ||
@@ -23,3 +24,2 @@ listening = true; | ||
}); | ||
} | ||
}; | ||
@@ -29,3 +29,3 @@ | ||
server.use('/_healthchecks', healthchecks({ | ||
filename: __dirname + '/../checks/default', | ||
filename: Path.join(__dirname, '../checks/default'), | ||
onFailed: function(failed) { | ||
@@ -32,0 +32,0 @@ server.emit('failed', failed); |
@@ -22,6 +22,6 @@ const Browser = require('zombie'); | ||
browser.assert.text('h1', 'Passed'); | ||
browser.assert.text('.passed li:nth-of-type(1)', /http:\/\/localhost\/error \d+ms/); | ||
browser.assert.text('.passed li:nth-of-type(2)', /http:\/\/localhost\/expected \d+ms/); | ||
browser.assert.text('.passed li:nth-of-type(3)', /http:\/\/localhost\/status \d+ms/); | ||
browser.assert.text('.passed li:nth-of-type(4)', /http:\/\/localhost\/timeout \d+ms/); | ||
browser.assert.text('.passed li:nth-of-type(1)', /http:\/\/localhost\/error \d+\.\d{2} sec/); | ||
browser.assert.text('.passed li:nth-of-type(2)', /http:\/\/localhost\/expected \d+\.\d{2} sec/); | ||
browser.assert.text('.passed li:nth-of-type(3)', /http:\/\/localhost\/status \d+\.\d{2} sec/); | ||
browser.assert.text('.passed li:nth-of-type(4)', /http:\/\/localhost\/timeout \d+\.\d{2} sec/); | ||
done(); | ||
@@ -42,3 +42,3 @@ }); | ||
browser.assert.elements('.failed li', 1); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/error => socket hang up \d+ms$/); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/error => socket hang up \d+\.\d{2} sec$/); | ||
browser.assert.elements('.passed li', 3); | ||
@@ -66,3 +66,3 @@ done(); | ||
browser.assert.elements('.failed li', 1); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/timeout => timeout \d+s$/); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/timeout => timeout \d+\.\d{2} sec$/); | ||
browser.assert.elements('.passed li', 3); | ||
@@ -88,3 +88,3 @@ done(); | ||
browser.assert.elements('.failed li', 1); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/status => 400 \d+ms$/); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/status => 400 \d+\.\d{2} sec$/); | ||
browser.assert.elements('.passed li', 3); | ||
@@ -110,3 +110,3 @@ done(); | ||
browser.assert.elements('.failed li', 1); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/expected => body \d+ms$/); | ||
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/expected => body \d+\.\d{2} sec$/); | ||
browser.assert.elements('.passed li', 3); | ||
@@ -113,0 +113,0 @@ done(); |
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
33912
20
608
4