Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates README and tests #8

Open
wants to merge 1 commit into
base: realmaster
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
machine:
node:
version: 8.0.0
test:
pre:
- npm run eslint
post:
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- mv ./test.xml $CIRCLE_TEST_REPORTS/junit/

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