From ef1aeb94aae12b8b4f685c94210ec26ba5a08e48 Mon Sep 17 00:00:00 2001 From: Gal Neugroschl Date: Tue, 20 Jun 2017 18:29:08 -0700 Subject: [PATCH] Updates README and tests Updates README to current options and updates tests to use new name given to the plugin --- README.md | 8 +++++++- package-lock.json | 4 ++-- package.json | 2 +- test/index.js | 19 +++++++++---------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 67d6800..ffa548a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ A Hapi plugin for rollbar painless integration accessToken: '', environment: '', // optional, defaults to process.env.NODE_ENV handleUncaughtExceptions: true // optional, defaults to false + sanitize: function(err) { ... }, // optional, to clean error messages + // sent to rollbar; defaults to no + // change to the message + filter: function(err) { ... }, // optional, to filter the error messages + // sent to rollbar; defaults to no + // filter } }, function (err) { if (err) throw err; @@ -27,7 +33,7 @@ A Hapi plugin for rollbar painless integration # Exposes - server.plugins['rollbar-hapi'].rollbar // the rollbar module, already initialised + server.plugins['@soxhub/rollbar-hapi'].rollbar // the rollbar module, already initialised The exposed `rollbar` above can be used to access rollbar's `log`, `debug`, `info`, `warning`, `error`, and `critical` methods diff --git a/package-lock.json b/package-lock.json index 8465b82..4953f40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "rollbar-hapi", - "version": "0.0.10", + "name": "@soxhub/rollbar-hapi", + "version": "0.0.11", "lockfileVersion": 1, "dependencies": { "accept": { diff --git a/package.json b/package.json index 4d76317..403c5a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@soxhub/rollbar-hapi", - "version": "0.0.10", + "version": "0.0.11", "description": "A Hapi plugin for rollbar painless integration", "author": "SOXHUB ", "engine": "node >= 0.10.x", diff --git a/test/index.js b/test/index.js index 3c653ad..3a92aa3 100644 --- a/test/index.js +++ b/test/index.js @@ -10,13 +10,13 @@ var expect = require('chai').expect; lab.experiment('plugin exposes', function() { lab.test('should expose rollbar', function(done) { var server = makeServerWithPlugin(); - expect(server.plugins['rollbar-hapi'].rollbar).to.not.be.empty; + expect(server.plugins['@soxhub/rollbar-hapi'].rollbar).to.not.be.empty; done(); }); lab.test('should expose rollbar error function', function (done) { var server = makeServerWithPlugin(); - var rollbar = server.plugins['rollbar-hapi'].rollbar; + var rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; expect(rollbar.error).to.be.a('function'); done(); @@ -55,7 +55,7 @@ lab.experiment('plugin relays server errors to rollbar', function() { }; // Wrap `rollbar.warning` with a spy - let rollbar = server.plugins['rollbar-hapi'].rollbar; + var rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; let spy = sinon.stub(rollbar,'warning'); // The emitting of the `tail` event is the last step in the hapi request cycle @@ -76,7 +76,7 @@ lab.experiment('plugin relays server errors to rollbar', function() { lab.test('should relay internal errors', function(done) { var server = makeServerWithPlugin(); - let rollbar = server.plugins['rollbar-hapi'].rollbar; + var rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; server.route({ method: 'GET', @@ -109,7 +109,7 @@ lab.experiment('plugin relays server errors to rollbar', function() { lab.test('should relay 4xx bad request errors', function(done) { var server = makeServerWithPlugin(); - var rollbar = server.plugins['rollbar-hapi'].rollbar; + var rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; server.route({ method: 'GET', @@ -145,7 +145,7 @@ lab.experiment('plugin relays server errors to rollbar', function() { } }); - var rollbar = server.plugins['rollbar-hapi'].rollbar; + var rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; server.route({ method: 'GET', @@ -195,7 +195,7 @@ lab.experiment('plugin relays server errors that are not filtered to rollbar', f } }); - let rollbar = server.plugins['rollbar-hapi'].rollbar; + let rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; let stub = sinon.stub(rollbar,'error'); const request = { @@ -232,7 +232,7 @@ lab.experiment('plugin relays server errors that are not filtered to rollbar', f } }); - let rollbar = server.plugins['rollbar-hapi'].rollbar; + let rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; let stub = sinon.stub(rollbar,'error'); const request = { @@ -261,7 +261,7 @@ lab.experiment('plugin relays server errors that are not filtered to rollbar', f } }); - let rollbar = server.plugins['rollbar-hapi'].rollbar; + let rollbar = server.plugins['@soxhub/rollbar-hapi'].rollbar; let stub = sinon.stub(rollbar,'error'); const request = { @@ -278,7 +278,6 @@ lab.experiment('plugin relays server errors that are not filtered to rollbar', f server.inject(request); }); - }); var makeServerWithPlugin = function (moreOptions = {}) {