Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

healthchecks

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

healthchecks - npm Package Compare versions

Comparing version 1.4.5 to 1.5.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## Version 1.5.0 2015-05-16
CHANGED show response time in high resolution (including nanoseconds)
## Version 1.4.4 2015-04-16

@@ -2,0 +7,0 @@

16

lib/healthchecks.js

@@ -28,2 +28,3 @@ // Exports an Express middleware factory.

const Path = require('path');
const hrTime = require('pretty-hrtime');
const URL = require('url');

@@ -39,3 +40,3 @@

this.url = url;
this.elapsed = elapsed;
this.elapsed = hrTime(elapsed);
if (error && error.code === 'ETIMEDOUT') {

@@ -112,8 +113,3 @@ this.reason = 'timeout';

// 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

@@ -146,6 +142,6 @@ // with the properties:

};
const start = Date.now();
const start = process.hrtime();
HTTP.get(request)
.on('response', function(response) {
const elapsed = Date.now() - start;
const elapsed = process.hrtime(start);
if (response.statusCode < 200 || response.statusCode >= 400)

@@ -166,3 +162,3 @@ resolve(new Outcome(checkURL, expected, null, response.statusCode, null, elapsed));

.on('error', function(error) {
const elapsed = Date.now() - start;
const elapsed = process.hrtime(start);
resolve(new Outcome(checkURL, expected, error, null, null, elapsed));

@@ -172,3 +168,3 @@ });

setTimeout(function() {
const elapsed = Date.now() - start;
const elapsed = process.hrtime(start);
const error = new Error('ETIMEDOUT');

@@ -175,0 +171,0 @@ error.code = 'ETIMEDOUT';

{
"name": "healthchecks",
"version": "1.4.5",
"version": "1.5.0",
"scripts": {

@@ -13,10 +13,11 @@ "test": "mocha"

"lodash": "^3.0",
"ms": "^0.7.1"
"ms": "^0.7.1",
"pretty-hrtime": "^1.0.0"
},
"devDependencies": {
"eslint": "^0.21.0",
"express": "^4.12.3",
"mocha": "^2.2.4",
"eslint": "^0.21",
"express": "^4.12",
"mocha": "^2.2",
"request": "^2.0",
"zombie": "^4.0.10"
"zombie": "^4.0"
},

@@ -23,0 +24,0 @@ "description": "Express middleware that runs health checks on your application",

@@ -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+\.\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/);
browser.assert.text('.passed li:nth-of-type(1)', /http:\/\/localhost\/error \d[.\d]* ms/);
browser.assert.text('.passed li:nth-of-type(2)', /http:\/\/localhost\/expected \d[.\d]* ms/);
browser.assert.text('.passed li:nth-of-type(3)', /http:\/\/localhost\/status \d[.\d]* ms/);
browser.assert.text('.passed li:nth-of-type(4)', /http:\/\/localhost\/timeout \d[.\d]* ms/);
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+\.\d{2} sec$/);
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/error => socket hang up \d[.\d]* ms/);
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+\.\d{2} sec$/);
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/timeout => timeout \d[.\d]* s/);
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+\.\d{2} sec$/);
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/status => 400 \d[.\d]* ms/);
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+\.\d{2} sec$/);
browser.assert.text('.failed li:nth-of-type(1)', /^http:\/\/localhost\/expected => body \d[.\d]* ms/);
browser.assert.elements('.passed li', 3);

@@ -113,0 +113,0 @@ done();

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc