Skip to content

Commit

Permalink
Updates README and tests
Browse files Browse the repository at this point in the history
Updates README to current options and
updates tests to use new name given to the
plugin
  • Loading branch information
galnoy committed Jun 21, 2017
1 parent 8b52f49 commit ef1aeb9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ 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;
});

# 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
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"engine": "node >= 0.10.x",
Expand Down
19 changes: 9 additions & 10 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand All @@ -278,7 +278,6 @@ lab.experiment('plugin relays server errors that are not filtered to rollbar', f

server.inject(request);
});

});

var makeServerWithPlugin = function (moreOptions = {}) {
Expand Down

0 comments on commit ef1aeb9

Please sign in to comment.