rollbar 2.26.2 → 2.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +32 -10
- package/.lgtm.yml +7 -7
- package/.prettierignore +18 -0
- package/.vscode/settings.json +39 -0
- package/CHANGELOG.md +121 -35
- package/Gruntfile.js +51 -71
- package/README.md +2 -4
- package/bower.json +1 -3
- package/defaults.js +17 -5
- package/dist/plugins/jquery.min.js +1 -1
- package/dist/rollbar.js +5699 -5052
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +5704 -5062
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +5693 -5052
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +5704 -5063
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/docs/extension-exceptions.md +35 -30
- package/docs/migration_v0_to_v1.md +41 -38
- package/index.d.ts +270 -231
- package/karma.conf.js +16 -34
- package/package.json +21 -17
- package/prettier.config.js +7 -0
- package/src/api.js +21 -10
- package/src/apiUtility.js +12 -8
- package/src/browser/core.js +103 -65
- package/src/browser/defaults/scrubFields.js +3 -3
- package/src/browser/detection.js +7 -8
- package/src/browser/domUtility.js +18 -8
- package/src/browser/globalSetup.js +12 -6
- package/src/browser/logger.js +1 -1
- package/src/browser/plugins/jquery.js +35 -35
- package/src/browser/predicates.js +1 -1
- package/src/browser/rollbar.js +1 -1
- package/src/browser/rollbarWrapper.js +8 -5
- package/src/browser/shim.js +43 -19
- package/src/browser/snippet_callback.js +6 -4
- package/src/browser/telemetry.js +573 -354
- package/src/browser/transforms.js +46 -27
- package/src/browser/transport/fetch.js +16 -14
- package/src/browser/transport/xhr.js +29 -13
- package/src/browser/transport.js +82 -25
- package/src/browser/url.js +16 -8
- package/src/browser/wrapGlobals.js +27 -8
- package/src/defaults.js +3 -3
- package/src/errorParser.js +14 -11
- package/src/merge.js +32 -23
- package/src/notifier.js +16 -13
- package/src/predicates.js +43 -23
- package/src/queue.js +71 -39
- package/src/rateLimiter.js +59 -18
- package/src/react-native/logger.js +1 -1
- package/src/react-native/rollbar.js +59 -55
- package/src/react-native/transforms.js +13 -9
- package/src/react-native/transport.js +44 -34
- package/src/rollbar.js +22 -13
- package/src/scrub.js +0 -1
- package/src/server/locals.js +69 -39
- package/src/server/logger.js +4 -4
- package/src/server/parser.js +72 -47
- package/src/server/rollbar.js +133 -55
- package/src/server/sourceMap/stackTrace.js +33 -18
- package/src/server/telemetry/urlHelpers.js +9 -11
- package/src/server/telemetry.js +68 -45
- package/src/server/transforms.js +37 -21
- package/src/server/transport.js +62 -32
- package/src/telemetry.js +92 -28
- package/src/transforms.js +33 -21
- package/src/truncation.js +8 -5
- package/src/utility/headers.js +43 -43
- package/src/utility/replace.js +9 -0
- package/src/utility/traverse.js +1 -1
- package/src/utility.js +89 -52
- package/test/api.test.js +31 -29
- package/test/apiUtility.test.js +43 -44
- package/test/browser.core.test.js +141 -131
- package/test/browser.domUtility.test.js +52 -35
- package/test/browser.predicates.test.js +13 -13
- package/test/browser.rollbar.test.js +597 -503
- package/test/browser.telemetry.test.js +76 -0
- package/test/browser.transforms.test.js +146 -128
- package/test/browser.transport.test.js +54 -46
- package/test/browser.url.test.js +12 -11
- package/test/fixtures/locals.fixtures.js +245 -126
- package/test/notifier.test.js +90 -78
- package/test/predicates.test.js +260 -214
- package/test/queue.test.js +230 -214
- package/test/rateLimiter.test.js +50 -42
- package/test/react-native.rollbar.test.js +149 -115
- package/test/react-native.transforms.test.js +21 -23
- package/test/react-native.transport.test.js +23 -11
- package/test/server.lambda.test.js +70 -53
- package/test/server.locals.test.js +437 -210
- package/test/server.parser.test.js +32 -26
- package/test/server.predicates.test.js +45 -43
- package/test/server.rollbar.test.js +311 -259
- package/test/server.telemetry.test.js +208 -83
- package/test/server.transforms.test.js +455 -361
- package/test/server.transport.test.js +144 -76
- package/test/telemetry.test.js +46 -37
- package/test/transforms.test.js +68 -66
- package/test/truncation.test.js +55 -53
- package/test/utility.test.js +266 -222
- package/webpack.config.js +46 -43
- package/.gitmodules +0 -3
- package/browserstack.browsers.js +0 -153
- package/browserstack.browsers.json +0 -4384
package/test/notifier.test.js
CHANGED
|
@@ -7,29 +7,29 @@ var Notifier = require('../src/notifier');
|
|
|
7
7
|
|
|
8
8
|
var rollbarConfig = {
|
|
9
9
|
accessToken: '12c99de67a444c229fca100e0967486f',
|
|
10
|
-
captureUncaught: true
|
|
10
|
+
captureUncaught: true,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
function TestQueueGenerator() {
|
|
14
|
-
var TestQueue = function() {
|
|
14
|
+
var TestQueue = function () {
|
|
15
15
|
this.items = [];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
TestQueue.prototype.addPendingItem = function(){};
|
|
19
|
-
TestQueue.prototype.removePendingItem = function(){};
|
|
20
|
-
TestQueue.prototype.addItem = function(item, callback) {
|
|
21
|
-
this.items.push({item: item, callback: callback});
|
|
18
|
+
TestQueue.prototype.addPendingItem = function () {};
|
|
19
|
+
TestQueue.prototype.removePendingItem = function () {};
|
|
20
|
+
TestQueue.prototype.addItem = function (item, callback) {
|
|
21
|
+
this.items.push({ item: item, callback: callback });
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
TestQueue.prototype.configure = function() {};
|
|
24
|
+
TestQueue.prototype.configure = function () {};
|
|
25
25
|
|
|
26
26
|
return TestQueue;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
describe('Notifier()', function() {
|
|
30
|
-
it('should have all of the expected methods', function(done) {
|
|
29
|
+
describe('Notifier()', function () {
|
|
30
|
+
it('should have all of the expected methods', function (done) {
|
|
31
31
|
var queue = new (TestQueueGenerator())();
|
|
32
|
-
var options = {enabled: true};
|
|
32
|
+
var options = { enabled: true };
|
|
33
33
|
var notifier = new Notifier(queue, options);
|
|
34
34
|
expect(notifier).to.have.property('configure');
|
|
35
35
|
expect(notifier).to.have.property('addTransform');
|
|
@@ -39,13 +39,13 @@ describe('Notifier()', function() {
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
describe('configure', function() {
|
|
43
|
-
it('should update the options', function(done) {
|
|
42
|
+
describe('configure', function () {
|
|
43
|
+
it('should update the options', function (done) {
|
|
44
44
|
var queue = new (TestQueueGenerator())();
|
|
45
|
-
var options = {someBool: true, other: 'stuff', enabled: true};
|
|
45
|
+
var options = { someBool: true, other: 'stuff', enabled: true };
|
|
46
46
|
var notifier = new Notifier(queue, options);
|
|
47
47
|
|
|
48
|
-
notifier.configure({other: 'baz'});
|
|
48
|
+
notifier.configure({ other: 'baz' });
|
|
49
49
|
|
|
50
50
|
expect(notifier.options.someBool).to.be.ok();
|
|
51
51
|
expect(notifier.options.other).to.eql('baz');
|
|
@@ -53,21 +53,23 @@ describe('configure', function() {
|
|
|
53
53
|
done();
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('should pass the updated options to the transform', function(done) {
|
|
56
|
+
it('should pass the updated options to the transform', function (done) {
|
|
57
57
|
var queue = new (TestQueueGenerator())();
|
|
58
|
-
var options = {someBool: true, enabled: true};
|
|
58
|
+
var options = { someBool: true, enabled: true };
|
|
59
59
|
var notifier = new Notifier(queue, options);
|
|
60
60
|
|
|
61
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
62
|
-
notifier
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
62
|
+
notifier
|
|
63
|
+
.addTransform(function (i, o, cb) {
|
|
64
|
+
expect(o.someBool).to.not.be.ok();
|
|
65
|
+
cb(null, { a: 42, b: i.b });
|
|
66
|
+
})
|
|
67
|
+
.addTransform(function (i, o, cb) {
|
|
68
|
+
expect(o.someBool).to.not.be.ok();
|
|
69
|
+
cb(null, { a: i.a + 1, b: i.b });
|
|
70
|
+
});
|
|
69
71
|
|
|
70
|
-
notifier.configure({someBool: false});
|
|
72
|
+
notifier.configure({ someBool: false });
|
|
71
73
|
|
|
72
74
|
var spy = sinon.spy();
|
|
73
75
|
notifier.log(initialItem, spy);
|
|
@@ -80,31 +82,31 @@ describe('configure', function() {
|
|
|
80
82
|
|
|
81
83
|
done();
|
|
82
84
|
});
|
|
83
|
-
it('should not add an item if disabled in constructor', function(done) {
|
|
85
|
+
it('should not add an item if disabled in constructor', function (done) {
|
|
84
86
|
var queue = new (TestQueueGenerator())();
|
|
85
|
-
var options = {someBool: true, enabled: false};
|
|
87
|
+
var options = { someBool: true, enabled: false };
|
|
86
88
|
var notifier = new Notifier(queue, options);
|
|
87
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
89
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
88
90
|
notifier.log(initialItem);
|
|
89
91
|
expect(queue.items.length).to.eql(0);
|
|
90
92
|
done();
|
|
91
93
|
});
|
|
92
|
-
it('should not add an item if disabled via call to configure', function(done) {
|
|
94
|
+
it('should not add an item if disabled via call to configure', function (done) {
|
|
93
95
|
var queue = new (TestQueueGenerator())();
|
|
94
|
-
var options = {someBool: true, enabled: true};
|
|
96
|
+
var options = { someBool: true, enabled: true };
|
|
95
97
|
var notifier = new Notifier(queue, options);
|
|
96
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
97
|
-
notifier.configure({enabled: false});
|
|
98
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
99
|
+
notifier.configure({ enabled: false });
|
|
98
100
|
notifier.log(initialItem);
|
|
99
101
|
expect(queue.items.length).to.eql(0);
|
|
100
102
|
done();
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
|
|
104
|
-
describe('addTransform', function() {
|
|
105
|
-
it('should not add a non-function', function(done) {
|
|
106
|
+
describe('addTransform', function () {
|
|
107
|
+
it('should not add a non-function', function (done) {
|
|
106
108
|
var queue = new (TestQueueGenerator())();
|
|
107
|
-
var options = {enabled: true};
|
|
109
|
+
var options = { enabled: true };
|
|
108
110
|
var notifier = new Notifier(queue, options);
|
|
109
111
|
|
|
110
112
|
expect(notifier.transforms.length).to.eql(0);
|
|
@@ -114,26 +116,28 @@ describe('addTransform', function() {
|
|
|
114
116
|
done();
|
|
115
117
|
});
|
|
116
118
|
|
|
117
|
-
it('should add a function', function(done) {
|
|
119
|
+
it('should add a function', function (done) {
|
|
118
120
|
var queue = new (TestQueueGenerator())();
|
|
119
|
-
var options = {enabled: true};
|
|
121
|
+
var options = { enabled: true };
|
|
120
122
|
var notifier = new Notifier(queue, options);
|
|
121
123
|
|
|
122
124
|
expect(notifier.transforms.length).to.eql(0);
|
|
123
|
-
notifier.addTransform(function() {
|
|
125
|
+
notifier.addTransform(function () {
|
|
126
|
+
return;
|
|
127
|
+
});
|
|
124
128
|
expect(notifier.transforms.length).to.eql(1);
|
|
125
129
|
|
|
126
130
|
done();
|
|
127
131
|
});
|
|
128
132
|
});
|
|
129
133
|
|
|
130
|
-
describe('log', function() {
|
|
131
|
-
it('should work without any transforms', function(done) {
|
|
134
|
+
describe('log', function () {
|
|
135
|
+
it('should work without any transforms', function (done) {
|
|
132
136
|
var queue = new (TestQueueGenerator())();
|
|
133
|
-
var options = {enabled: true};
|
|
137
|
+
var options = { enabled: true };
|
|
134
138
|
var notifier = new Notifier(queue, options);
|
|
135
139
|
|
|
136
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
140
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
137
141
|
var spy = sinon.spy();
|
|
138
142
|
notifier.log(initialItem, spy);
|
|
139
143
|
expect(spy.called).to.not.be.ok();
|
|
@@ -143,17 +147,19 @@ describe('log', function() {
|
|
|
143
147
|
done();
|
|
144
148
|
});
|
|
145
149
|
|
|
146
|
-
it('should apply the transforms', function(done) {
|
|
150
|
+
it('should apply the transforms', function (done) {
|
|
147
151
|
var queue = new (TestQueueGenerator())();
|
|
148
|
-
var options = {enabled: true};
|
|
152
|
+
var options = { enabled: true };
|
|
149
153
|
var notifier = new Notifier(queue, options);
|
|
150
154
|
|
|
151
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
152
|
-
notifier
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
156
|
+
notifier
|
|
157
|
+
.addTransform(function (i, o, cb) {
|
|
158
|
+
cb(null, { a: 42, b: i.b });
|
|
159
|
+
})
|
|
160
|
+
.addTransform(function (i, o, cb) {
|
|
161
|
+
cb(null, { a: i.a + 1, b: i.b });
|
|
162
|
+
});
|
|
157
163
|
var spy = sinon.spy();
|
|
158
164
|
notifier.log(initialItem, spy);
|
|
159
165
|
|
|
@@ -166,19 +172,21 @@ describe('log', function() {
|
|
|
166
172
|
done();
|
|
167
173
|
});
|
|
168
174
|
|
|
169
|
-
it('should stop and callback if a transform errors', function(done) {
|
|
175
|
+
it('should stop and callback if a transform errors', function (done) {
|
|
170
176
|
var queue = new (TestQueueGenerator())();
|
|
171
|
-
var options = {enabled: true};
|
|
177
|
+
var options = { enabled: true };
|
|
172
178
|
var notifier = new Notifier(queue, options);
|
|
173
179
|
|
|
174
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
180
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
175
181
|
var error = new Error('fizz buzz');
|
|
176
|
-
notifier
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
notifier
|
|
183
|
+
.addTransform(function (i, o, cb) {
|
|
184
|
+
cb(error, null);
|
|
185
|
+
})
|
|
186
|
+
.addTransform(function (i, o, cb) {
|
|
187
|
+
expect(false).to.be.ok(); // assert this is not called
|
|
188
|
+
cb(null, { a: 42, b: i.b });
|
|
189
|
+
});
|
|
182
190
|
var spy = sinon.spy();
|
|
183
191
|
notifier.log(initialItem, spy);
|
|
184
192
|
|
|
@@ -189,18 +197,20 @@ describe('log', function() {
|
|
|
189
197
|
done();
|
|
190
198
|
});
|
|
191
199
|
|
|
192
|
-
it('should work without a callback', function(done) {
|
|
200
|
+
it('should work without a callback', function (done) {
|
|
193
201
|
var queue = new (TestQueueGenerator())();
|
|
194
|
-
var options = {enabled: true};
|
|
202
|
+
var options = { enabled: true };
|
|
195
203
|
var notifier = new Notifier(queue, options);
|
|
196
204
|
|
|
197
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
198
|
-
notifier
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
206
|
+
notifier
|
|
207
|
+
.addTransform(function (i, o, cb) {
|
|
208
|
+
cb(new Error('fizz buzz'), null);
|
|
209
|
+
})
|
|
210
|
+
.addTransform(function (i, o, cb) {
|
|
211
|
+
expect(false).to.be.ok(); // assert this is not called
|
|
212
|
+
cb(null, { a: 42, b: i.b });
|
|
213
|
+
});
|
|
204
214
|
notifier.log(initialItem);
|
|
205
215
|
|
|
206
216
|
expect(queue.items.length).to.eql(0);
|
|
@@ -208,19 +218,21 @@ describe('log', function() {
|
|
|
208
218
|
done();
|
|
209
219
|
});
|
|
210
220
|
|
|
211
|
-
it('should pass the options to the transforms', function(done) {
|
|
221
|
+
it('should pass the options to the transforms', function (done) {
|
|
212
222
|
var queue = new (TestQueueGenerator())();
|
|
213
|
-
var options = {enabled: true, someBool: true};
|
|
223
|
+
var options = { enabled: true, someBool: true };
|
|
214
224
|
var notifier = new Notifier(queue, options);
|
|
215
225
|
|
|
216
|
-
var initialItem = {a: 123, b: 'a string'};
|
|
217
|
-
notifier
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
var initialItem = { a: 123, b: 'a string' };
|
|
227
|
+
notifier
|
|
228
|
+
.addTransform(function (i, o, cb) {
|
|
229
|
+
expect(o.someBool).to.be.ok();
|
|
230
|
+
cb(null, { a: 42, b: i.b });
|
|
231
|
+
})
|
|
232
|
+
.addTransform(function (i, o, cb) {
|
|
233
|
+
expect(o.someBool).to.be.ok();
|
|
234
|
+
cb(null, { a: i.a + 1, b: i.b });
|
|
235
|
+
});
|
|
224
236
|
var spy = sinon.spy();
|
|
225
237
|
notifier.log(initialItem, spy);
|
|
226
238
|
|