Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Add test for global breadcrumb capture
Browse files Browse the repository at this point in the history
  • Loading branch information
LewisJEllis committed Feb 7, 2017
1 parent 71c35c7 commit db9c6bb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ extend(Raven.prototype, {
eventId = this.generateEventId();
}


var domainContext = domain.active && domain.active.sentryContext || {};
kwargs.user = extend({}, this._globalContext.user, domainContext.user, kwargs.user);
kwargs.tags = extend({}, this._globalContext.tags, domainContext.tags, kwargs.tags);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"scripts": {
"pretest": "npm install && npm run lint",
"test": "NODE_ENV=test istanbul cover _mocha -- --reporter dot && NODE_ENV=test node_modules/coffee-script/bin/coffee ./test/run.coffee",
"test-mocha": "NODE_ENV=test mocha",
"test-full": "npm run test && cd test/instrumentation && ./run.sh",
"lint": "node_modules/eslint/bin/eslint.js ."
},
Expand Down
19 changes: 18 additions & 1 deletion test/raven.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,26 @@ describe('raven.Client', function () {
category: 'test',
message: message
});
client.getContext().should.not.equal(client._globalContext);
client.getContext().breadcrumbs[0].message.should.equal(message);
done();
});
done();
});

it('should capture breadcrumbs at global context level', function (done) {
var message = 'test breadcrumb';
client = new raven.Client(dsn, {
shouldSendCallback: function (data) {
data.breadcrumbs.values.length.should.equal(1);
done();
}
});
client.install();
client.captureBreadcrumb({
category: 'test',
message: message
});
client.captureException(new Error('oh no'));
});

it('should instrument console to capture breadcrumbs', function (done) {
Expand Down

0 comments on commit db9c6bb

Please sign in to comment.