Skip to content

Commit dc1dfef

Browse files
committed
Fix tests, lint errors
1 parent 2cab593 commit dc1dfef

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

plugins/angular.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ var angularPattern = /^\[((?:[$a-zA-Z0-9]+:)?(?:[$a-zA-Z0-9]+))\] (.+?)\n(\S+)$/
1010

1111
function angularPlugin(Raven, angular) {
1212
/*jshint validthis:true*/
13-
var angular = angular || window.angular;
13+
angular = angular || window.angular;
14+
15+
if (!angular) return;
1416

1517
function RavenProvider() {
1618
this.$get = ['$window', function($window) {
@@ -32,9 +34,6 @@ function angularPlugin(Raven, angular) {
3234
};
3335
}
3436

35-
var angular = window.angular;
36-
if (!angular) return;
37-
3837
angular.module('ngRaven', [])
3938
.provider('Raven', RavenProvider)
4039
.config(['$provide', ExceptionHandlerProvider]);

plugins/backbone.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
*
44
* Patches Backbone.Events callbacks.
55
*/
6+
'use strict';
67

78
function backbonePlugin(Raven, Backbone) {
8-
var Backbone = Backbone || window.Backbone;
9+
Backbone = Backbone || window.Backbone;
910

1011
// quit if Backbone isn't on the page
1112
if (!Backbone) return;

plugins/console.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'use strict';
88

99
function consolePlugin(Raven, console) {
10-
var console = console || window.console || {};
10+
console = console || window.console || {};
1111

1212
var originalConsole = console,
1313
logLevels = ['debug', 'info', 'warn', 'error'],

plugins/native.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Extends support for global error handling for asynchronous browser
55
* functions. Adopted from Closure Library's errorhandler.js.
66
*/
7+
'use strict';
8+
79
function nativePlugin(Raven) {
810
var _helper = function _helper(fnName) {
911
var originalFn = window[fnName];

plugins/require.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*global define*/
12
/**
23
* require.js plugin
34
*
@@ -6,10 +7,10 @@
67
'use strict';
78

89
function requirePlugin(Raven) {
9-
if (typeof define === 'function' && define.amd) {
10-
window.define = Raven.wrap({deep: false}, define);
11-
window.require = Raven.wrap({deep: false}, require);
12-
}
10+
if (typeof define === 'function' && define.amd) {
11+
window.define = Raven.wrap({deep: false}, define);
12+
window.require = Raven.wrap({deep: false}, require);
13+
}
1314
}
1415

1516
module.exports = requirePlugin;

test/raven.test.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1580,9 +1580,15 @@ describe('Raven (public API)', function() {
15801580
it('should register itself with TraceKit', function() {
15811581
this.sinon.stub(Raven, 'isSetup').returns(true);
15821582
this.sinon.stub(TraceKit.report, 'subscribe');
1583+
this.sinon.stub(Raven, '_handleStackInfo');
15831584
assert.equal(Raven, Raven.install());
15841585
assert.isTrue(TraceKit.report.subscribe.calledOnce);
1585-
assert.equal(TraceKit.report.subscribe.lastCall.args[0], Raven._handleStackInfo);
1586+
1587+
// `install` subscribes to TraceKit w/ an anonymous function that
1588+
// wraps _handleStackInfo to preserve `this`. Invoke the anonymous
1589+
// function and verify that `_handleStackInfo` is called.
1590+
TraceKit.report.subscribe.lastCall.args[0]();
1591+
assert.isTrue(Raven._handleStackInfo.calledOnce);
15861592
});
15871593

15881594
it('should not register itself more than once', function() {

0 commit comments

Comments
 (0)