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.
Files changed (117) hide show
  1. package/.github/workflows/ci.yml +32 -10
  2. package/.lgtm.yml +7 -7
  3. package/.prettierignore +18 -0
  4. package/.vscode/settings.json +39 -0
  5. package/CHANGELOG.md +121 -35
  6. package/Gruntfile.js +51 -71
  7. package/README.md +2 -4
  8. package/bower.json +1 -3
  9. package/defaults.js +17 -5
  10. package/dist/plugins/jquery.min.js +1 -1
  11. package/dist/rollbar.js +5699 -5052
  12. package/dist/rollbar.js.map +1 -1
  13. package/dist/rollbar.min.js +1 -1
  14. package/dist/rollbar.min.js.map +1 -1
  15. package/dist/rollbar.named-amd.js +5704 -5062
  16. package/dist/rollbar.named-amd.js.map +1 -1
  17. package/dist/rollbar.named-amd.min.js +1 -1
  18. package/dist/rollbar.named-amd.min.js.map +1 -1
  19. package/dist/rollbar.noconflict.umd.js +5693 -5052
  20. package/dist/rollbar.noconflict.umd.js.map +1 -1
  21. package/dist/rollbar.noconflict.umd.min.js +1 -1
  22. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  23. package/dist/rollbar.snippet.js +1 -1
  24. package/dist/rollbar.umd.js +5704 -5063
  25. package/dist/rollbar.umd.js.map +1 -1
  26. package/dist/rollbar.umd.min.js +1 -1
  27. package/dist/rollbar.umd.min.js.map +1 -1
  28. package/docs/extension-exceptions.md +35 -30
  29. package/docs/migration_v0_to_v1.md +41 -38
  30. package/index.d.ts +270 -231
  31. package/karma.conf.js +16 -34
  32. package/package.json +21 -17
  33. package/prettier.config.js +7 -0
  34. package/src/api.js +21 -10
  35. package/src/apiUtility.js +12 -8
  36. package/src/browser/core.js +103 -65
  37. package/src/browser/defaults/scrubFields.js +3 -3
  38. package/src/browser/detection.js +7 -8
  39. package/src/browser/domUtility.js +18 -8
  40. package/src/browser/globalSetup.js +12 -6
  41. package/src/browser/logger.js +1 -1
  42. package/src/browser/plugins/jquery.js +35 -35
  43. package/src/browser/predicates.js +1 -1
  44. package/src/browser/rollbar.js +1 -1
  45. package/src/browser/rollbarWrapper.js +8 -5
  46. package/src/browser/shim.js +43 -19
  47. package/src/browser/snippet_callback.js +6 -4
  48. package/src/browser/telemetry.js +573 -354
  49. package/src/browser/transforms.js +46 -27
  50. package/src/browser/transport/fetch.js +16 -14
  51. package/src/browser/transport/xhr.js +29 -13
  52. package/src/browser/transport.js +82 -25
  53. package/src/browser/url.js +16 -8
  54. package/src/browser/wrapGlobals.js +27 -8
  55. package/src/defaults.js +3 -3
  56. package/src/errorParser.js +14 -11
  57. package/src/merge.js +32 -23
  58. package/src/notifier.js +16 -13
  59. package/src/predicates.js +43 -23
  60. package/src/queue.js +71 -39
  61. package/src/rateLimiter.js +59 -18
  62. package/src/react-native/logger.js +1 -1
  63. package/src/react-native/rollbar.js +59 -55
  64. package/src/react-native/transforms.js +13 -9
  65. package/src/react-native/transport.js +44 -34
  66. package/src/rollbar.js +22 -13
  67. package/src/scrub.js +0 -1
  68. package/src/server/locals.js +69 -39
  69. package/src/server/logger.js +4 -4
  70. package/src/server/parser.js +72 -47
  71. package/src/server/rollbar.js +133 -55
  72. package/src/server/sourceMap/stackTrace.js +33 -18
  73. package/src/server/telemetry/urlHelpers.js +9 -11
  74. package/src/server/telemetry.js +68 -45
  75. package/src/server/transforms.js +37 -21
  76. package/src/server/transport.js +62 -32
  77. package/src/telemetry.js +92 -28
  78. package/src/transforms.js +33 -21
  79. package/src/truncation.js +8 -5
  80. package/src/utility/headers.js +43 -43
  81. package/src/utility/replace.js +9 -0
  82. package/src/utility/traverse.js +1 -1
  83. package/src/utility.js +89 -52
  84. package/test/api.test.js +31 -29
  85. package/test/apiUtility.test.js +43 -44
  86. package/test/browser.core.test.js +141 -131
  87. package/test/browser.domUtility.test.js +52 -35
  88. package/test/browser.predicates.test.js +13 -13
  89. package/test/browser.rollbar.test.js +597 -503
  90. package/test/browser.telemetry.test.js +76 -0
  91. package/test/browser.transforms.test.js +146 -128
  92. package/test/browser.transport.test.js +54 -46
  93. package/test/browser.url.test.js +12 -11
  94. package/test/fixtures/locals.fixtures.js +245 -126
  95. package/test/notifier.test.js +90 -78
  96. package/test/predicates.test.js +260 -214
  97. package/test/queue.test.js +230 -214
  98. package/test/rateLimiter.test.js +50 -42
  99. package/test/react-native.rollbar.test.js +149 -115
  100. package/test/react-native.transforms.test.js +21 -23
  101. package/test/react-native.transport.test.js +23 -11
  102. package/test/server.lambda.test.js +70 -53
  103. package/test/server.locals.test.js +437 -210
  104. package/test/server.parser.test.js +32 -26
  105. package/test/server.predicates.test.js +45 -43
  106. package/test/server.rollbar.test.js +311 -259
  107. package/test/server.telemetry.test.js +208 -83
  108. package/test/server.transforms.test.js +455 -361
  109. package/test/server.transport.test.js +144 -76
  110. package/test/telemetry.test.js +46 -37
  111. package/test/transforms.test.js +68 -66
  112. package/test/truncation.test.js +55 -53
  113. package/test/utility.test.js +266 -222
  114. package/webpack.config.js +46 -43
  115. package/.gitmodules +0 -3
  116. package/browserstack.browsers.js +0 -153
  117. package/browserstack.browsers.json +0 -4384
@@ -5,490 +5,536 @@
5
5
 
6
6
  var p = require('../src/predicates');
7
7
  var logger = {
8
- log: function() {},
9
- error: function() {}
8
+ log: function () {},
9
+ error: function () {},
10
10
  };
11
11
 
12
- describe('userCheckIgnore', function() {
13
- it('should return true if no user function', function() {
14
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
15
- var settings = {reportLevel: 'debug'};
12
+ describe('userCheckIgnore', function () {
13
+ it('should return true if no user function', function () {
14
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
15
+ var settings = { reportLevel: 'debug' };
16
16
  expect(p.userCheckIgnore(logger)(item, settings)).to.be.ok();
17
17
  });
18
- it('should return true if checkIgnore is not a function', function() {
19
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
20
- var settings = {reportLevel: 'debug', checkIgnore: true};
18
+ it('should return true if checkIgnore is not a function', function () {
19
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
20
+ var settings = { reportLevel: 'debug', checkIgnore: true };
21
21
  expect(p.userCheckIgnore(logger)(item, settings)).to.be.ok();
22
22
  });
23
- it('should return true if checkIgnore returns false', function() {
24
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
25
- var settings = {reportLevel: 'debug', checkIgnore: function() {
26
- return false;
27
- }};
23
+ it('should return true if checkIgnore returns false', function () {
24
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
25
+ var settings = {
26
+ reportLevel: 'debug',
27
+ checkIgnore: function () {
28
+ return false;
29
+ },
30
+ };
28
31
  expect(p.userCheckIgnore(logger)(item, settings)).to.be.ok();
29
32
  });
30
- it('should return false if checkIgnore returns true', function() {
31
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
32
- var settings = {reportLevel: 'debug', checkIgnore: function() {
33
- return true;
34
- }};
33
+ it('should return false if checkIgnore returns true', function () {
34
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
35
+ var settings = {
36
+ reportLevel: 'debug',
37
+ checkIgnore: function () {
38
+ return true;
39
+ },
40
+ };
35
41
  expect(p.userCheckIgnore(logger)(item, settings)).to.not.be.ok();
36
42
  });
37
- it('should return true if checkIgnore throws', function() {
38
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
39
- var settings = {reportLevel: 'debug', checkIgnore: function() {
40
- throw new Error('bork bork');
41
- }};
43
+ it('should return true if checkIgnore throws', function () {
44
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
45
+ var settings = {
46
+ reportLevel: 'debug',
47
+ checkIgnore: function () {
48
+ throw new Error('bork bork');
49
+ },
50
+ };
42
51
  expect(p.userCheckIgnore(logger)(item, settings)).to.be.ok();
43
52
  expect(settings.checkIgnore).to.not.be.ok();
44
53
  });
45
- it('should get the right arguments', function() {
46
- var item = {level: 'debug', body: 'stuff', _originalArgs: [1,2,3]};
47
- var settings = {reportLevel: 'debug', checkIgnore: function(isUncaught, args, payload) {
48
- expect(isUncaught).to.not.be.ok();
49
- expect(args).to.eql([1,2,3]);
50
- expect(payload).to.eql(item);
51
- }};
54
+ it('should get the right arguments', function () {
55
+ var item = { level: 'debug', body: 'stuff', _originalArgs: [1, 2, 3] };
56
+ var settings = {
57
+ reportLevel: 'debug',
58
+ checkIgnore: function (isUncaught, args, payload) {
59
+ expect(isUncaught).to.not.be.ok();
60
+ expect(args).to.eql([1, 2, 3]);
61
+ expect(payload).to.eql(item);
62
+ },
63
+ };
52
64
  expect(p.userCheckIgnore(logger)(item, settings)).to.be.ok();
53
65
  });
54
66
  });
55
67
 
56
- describe('urlIsSafeListed', function() {
68
+ describe('urlIsSafeListed', function () {
57
69
  var item = {
58
70
  level: 'critical',
59
- body: {trace: {frames: [
60
- {filename: 'http://api.fake.com/v1/something'},
61
- {filename: 'http://api.example.com/v1/something'},
62
- {filename: 'http://api.fake.com/v2/something'}
63
- ]}}
71
+ body: {
72
+ trace: {
73
+ frames: [
74
+ { filename: 'http://api.fake.com/v1/something' },
75
+ { filename: 'http://api.example.com/v1/something' },
76
+ { filename: 'http://api.fake.com/v2/something' },
77
+ ],
78
+ },
79
+ },
64
80
  };
65
81
  var traceChainItem = {
66
82
  level: 'critical',
67
- body: {trace_chain: [{frames: [
68
- {filename: 'http://api.fake.com/v1/something'},
69
- {filename: 'http://api.example.com/v1/something'},
70
- {filename: 'http://api.fake.com/v2/something'}
71
- ]},
72
- {frames: [
73
- {filename: 'http://api.fake1.com/v2/something'},
74
- {filename: 'http://api.example1.com/v2/something'},
75
- {filename: 'http://api.fake1.com/v3/something'}
76
- ]}
77
- ]}
83
+ body: {
84
+ trace_chain: [
85
+ {
86
+ frames: [
87
+ { filename: 'http://api.fake.com/v1/something' },
88
+ { filename: 'http://api.example.com/v1/something' },
89
+ { filename: 'http://api.fake.com/v2/something' },
90
+ ],
91
+ },
92
+ {
93
+ frames: [
94
+ { filename: 'http://api.fake1.com/v2/something' },
95
+ { filename: 'http://api.example1.com/v2/something' },
96
+ { filename: 'http://api.fake1.com/v3/something' },
97
+ ],
98
+ },
99
+ ],
100
+ },
78
101
  };
79
- it('should return true with no safelist', function() {
102
+ it('should return true with no safelist', function () {
80
103
  var settings = {
81
- reportLevel: 'debug'
104
+ reportLevel: 'debug',
82
105
  };
83
106
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
84
107
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
85
108
  });
86
- it('should return true with no trace', function() {
109
+ it('should return true with no trace', function () {
87
110
  var item = {
88
111
  level: 'critical',
89
- body: {message: 'hey'}
112
+ body: { message: 'hey' },
90
113
  };
91
114
  var settings = {
92
115
  reportLevel: 'debug',
93
- hostSafeList: ['fake.com', 'example.com']
116
+ hostSafeList: ['fake.com', 'example.com'],
94
117
  };
95
118
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
96
119
  });
97
- it('should return true if at least one regex matches at least one filename in the trace', function() {
120
+ it('should return true if at least one regex matches at least one filename in the trace', function () {
98
121
  var settings = {
99
122
  reportLevel: 'debug',
100
- hostSafeList: ['example.com']
123
+ hostSafeList: ['example.com'],
101
124
  };
102
125
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
103
126
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
104
127
  });
105
- it('should return true if the filename is not a string', function() {
128
+ it('should return true if the filename is not a string', function () {
106
129
  var item = {
107
130
  level: 'critical',
108
- body: {trace: {frames: [
109
- {filename: {url: 'http://api.fake.com/v1/something'}},
110
- {filename: {url: 'http://api.example.com/v1/something'}},
111
- {filename: {url: 'http://api.fake.com/v2/something'}},
112
- ]}}
131
+ body: {
132
+ trace: {
133
+ frames: [
134
+ { filename: { url: 'http://api.fake.com/v1/something' } },
135
+ { filename: { url: 'http://api.example.com/v1/something' } },
136
+ { filename: { url: 'http://api.fake.com/v2/something' } },
137
+ ],
138
+ },
139
+ },
113
140
  };
114
141
  var traceChainItem = {
115
142
  level: 'critical',
116
- body: {trace_chain: [{frames: [
117
- {filename: {url: 'http://api.fake.com/v1/something'}},
118
- {filename: {url: 'http://api.example.com/v1/something'}},
119
- {filename: {url: 'http://api.fake.com/v2/something'}},
120
- ]},
121
- {frames: [
122
- {filename: {url: 'http://api.fake.com/v1/something'}},
123
- {filename: {url: 'http://api.example.com/v1/something'}},
124
- {filename: {url: 'http://api.fake.com/v2/something'}},
125
- ]}
126
- ]}
143
+ body: {
144
+ trace_chain: [
145
+ {
146
+ frames: [
147
+ { filename: { url: 'http://api.fake.com/v1/something' } },
148
+ { filename: { url: 'http://api.example.com/v1/something' } },
149
+ { filename: { url: 'http://api.fake.com/v2/something' } },
150
+ ],
151
+ },
152
+ {
153
+ frames: [
154
+ { filename: { url: 'http://api.fake.com/v1/something' } },
155
+ { filename: { url: 'http://api.example.com/v1/something' } },
156
+ { filename: { url: 'http://api.fake.com/v2/something' } },
157
+ ],
158
+ },
159
+ ],
160
+ },
127
161
  };
128
162
  var settings = {
129
163
  reportLevel: 'debug',
130
- hostSafeList: ['nope.com']
164
+ hostSafeList: ['nope.com'],
131
165
  };
132
166
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
133
167
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
134
168
  });
135
- it('should return true if there is no frames key', function() {
169
+ it('should return true if there is no frames key', function () {
136
170
  var item = {
137
171
  level: 'critical',
138
- body: {trace: {notframes: []}}
172
+ body: { trace: { notframes: [] } },
139
173
  };
140
174
  var traceChainItem = {
141
175
  level: 'critical',
142
- body: {trace_chain: [
143
- {notframes: []},
144
- {notframes: []}
145
- ]}
176
+ body: { trace_chain: [{ notframes: [] }, { notframes: [] }] },
146
177
  };
147
178
  var settings = {
148
179
  reportLevel: 'debug',
149
- hostSafeList: ['nope.com']
180
+ hostSafeList: ['nope.com'],
150
181
  };
151
182
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
152
183
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
153
184
  });
154
- it('should return true if there are no frames', function() {
185
+ it('should return true if there are no frames', function () {
155
186
  var item = {
156
187
  level: 'critical',
157
- body: {trace: {frames: []}}
188
+ body: { trace: { frames: [] } },
158
189
  };
159
190
  var traceChainItem = {
160
191
  level: 'critical',
161
- body: {trace_chain: [
162
- {frames: []},
163
- {frames: []}
164
- ]}
192
+ body: { trace_chain: [{ frames: [] }, { frames: [] }] },
165
193
  };
166
194
  var settings = {
167
195
  reportLevel: 'debug',
168
- hostSafeList: ['nope.com']
196
+ hostSafeList: ['nope.com'],
169
197
  };
170
198
  expect(p.urlIsSafeListed(logger)(item, settings)).to.be.ok();
171
199
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.be.ok();
172
200
  });
173
- it('should return false if nothing in the safelist matches', function() {
201
+ it('should return false if nothing in the safelist matches', function () {
174
202
  var settings = {
175
203
  reportLevel: 'debug',
176
- hostSafeList: ['baz\.com', 'foo\.com']
204
+ hostSafeList: ['baz.com', 'foo.com'],
177
205
  };
178
206
  expect(p.urlIsSafeListed(logger)(item, settings)).to.not.be.ok();
179
207
  expect(p.urlIsSafeListed(logger)(traceChainItem, settings)).to.not.be.ok();
180
208
  });
181
209
  });
182
210
 
183
- describe('urlIsNotBlockListed', function() {
211
+ describe('urlIsNotBlockListed', function () {
184
212
  var item = {
185
213
  level: 'critical',
186
- body: {trace: {frames: [
187
- {filename: 'http://api.fake.com/v1/something'},
188
- {filename: 'http://api.example.com/v1/something'},
189
- {filename: 'http://api.fake.com/v2/something'}
190
- ]}}
214
+ body: {
215
+ trace: {
216
+ frames: [
217
+ { filename: 'http://api.fake.com/v1/something' },
218
+ { filename: 'http://api.example.com/v1/something' },
219
+ { filename: 'http://api.fake.com/v2/something' },
220
+ ],
221
+ },
222
+ },
191
223
  };
192
224
  var traceChainItem = {
193
225
  level: 'critical',
194
- body: {trace_chain: [{frames: [
195
- {filename: 'http://api.fake.com/v1/something'},
196
- {filename: 'http://api.example.com/v1/something'},
197
- {filename: 'http://api.fake.com/v2/something'}
198
- ]},
199
- {frames: [
200
- {filename: 'http://api.fake1.com/v2/something'},
201
- {filename: 'http://api.example1.com/v2/something'},
202
- {filename: 'http://api.fake1.com/v3/something'}
203
- ]}
204
- ]}
226
+ body: {
227
+ trace_chain: [
228
+ {
229
+ frames: [
230
+ { filename: 'http://api.fake.com/v1/something' },
231
+ { filename: 'http://api.example.com/v1/something' },
232
+ { filename: 'http://api.fake.com/v2/something' },
233
+ ],
234
+ },
235
+ {
236
+ frames: [
237
+ { filename: 'http://api.fake1.com/v2/something' },
238
+ { filename: 'http://api.example1.com/v2/something' },
239
+ { filename: 'http://api.fake1.com/v3/something' },
240
+ ],
241
+ },
242
+ ],
243
+ },
205
244
  };
206
- it('should return true with no blocklist', function() {
245
+ it('should return true with no blocklist', function () {
207
246
  var settings = {
208
- reportLevel: 'debug'
247
+ reportLevel: 'debug',
209
248
  };
210
249
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
211
250
  expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
212
251
  });
213
- it('should return true with no trace', function() {
252
+ it('should return true with no trace', function () {
214
253
  var item = {
215
254
  level: 'critical',
216
- body: {message: 'hey'}
255
+ body: { message: 'hey' },
217
256
  };
218
257
  var settings = {
219
258
  reportLevel: 'debug',
220
- hostBlockList: ['fake.com', 'other.com']
259
+ hostBlockList: ['fake.com', 'other.com'],
221
260
  };
222
261
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
223
262
  });
224
- it('should return false if any regex matches at least one filename in the trace', function() {
263
+ it('should return false if any regex matches at least one filename in the trace', function () {
225
264
  var settings = {
226
265
  reportLevel: 'debug',
227
- hostBlockList: ['example.com', 'other.com']
266
+ hostBlockList: ['example.com', 'other.com'],
228
267
  };
229
268
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.not.be.ok();
230
- expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.not.be.ok();
269
+ expect(
270
+ p.urlIsNotBlockListed(logger)(traceChainItem, settings),
271
+ ).to.not.be.ok();
231
272
  });
232
- it('should return true if the filename is not a string', function() {
273
+ it('should return true if the filename is not a string', function () {
233
274
  var item = {
234
275
  level: 'critical',
235
- body: {trace: {frames: [
236
- {filename: {url: 'http://api.fake.com/v1/something'}},
237
- {filename: {url: 'http://api.example.com/v1/something'}},
238
- {filename: {url: 'http://api.fake.com/v2/something'}},
239
- ]}}
276
+ body: {
277
+ trace: {
278
+ frames: [
279
+ { filename: { url: 'http://api.fake.com/v1/something' } },
280
+ { filename: { url: 'http://api.example.com/v1/something' } },
281
+ { filename: { url: 'http://api.fake.com/v2/something' } },
282
+ ],
283
+ },
284
+ },
240
285
  };
241
286
  var traceChainItem = {
242
287
  level: 'critical',
243
- body: {trace_chain: [{frames: [
244
- {filename: {url: 'http://api.fake.com/v1/something'}},
245
- {filename: {url: 'http://api.example.com/v1/something'}},
246
- {filename: {url: 'http://api.fake.com/v2/something'}},
247
- ]},
248
- {frames: [
249
- {filename: {url: 'http://api.fake.com/v1/something'}},
250
- {filename: {url: 'http://api.example.com/v1/something'}},
251
- {filename: {url: 'http://api.fake.com/v2/something'}},
252
- ]}
253
- ]}
288
+ body: {
289
+ trace_chain: [
290
+ {
291
+ frames: [
292
+ { filename: { url: 'http://api.fake.com/v1/something' } },
293
+ { filename: { url: 'http://api.example.com/v1/something' } },
294
+ { filename: { url: 'http://api.fake.com/v2/something' } },
295
+ ],
296
+ },
297
+ {
298
+ frames: [
299
+ { filename: { url: 'http://api.fake.com/v1/something' } },
300
+ { filename: { url: 'http://api.example.com/v1/something' } },
301
+ { filename: { url: 'http://api.fake.com/v2/something' } },
302
+ ],
303
+ },
304
+ ],
305
+ },
254
306
  };
255
307
  var settings = {
256
308
  reportLevel: 'debug',
257
- hostBlockList: ['example.com', 'other.com']
309
+ hostBlockList: ['example.com', 'other.com'],
258
310
  };
259
311
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
260
312
  expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
261
313
  });
262
- it('should return true if there is no frames key', function() {
314
+ it('should return true if there is no frames key', function () {
263
315
  var item = {
264
316
  level: 'critical',
265
- body: {trace: {notframes: []}}
317
+ body: { trace: { notframes: [] } },
266
318
  };
267
319
  var traceChainItem = {
268
320
  level: 'critical',
269
- body: {trace_chain: [
270
- {notframes: []},
271
- {notframes: []}
272
- ]}
321
+ body: { trace_chain: [{ notframes: [] }, { notframes: [] }] },
273
322
  };
274
323
  var settings = {
275
324
  reportLevel: 'debug',
276
- hostBlockList: ['nope.com']
325
+ hostBlockList: ['nope.com'],
277
326
  };
278
327
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
279
328
  expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
280
329
  });
281
- it('should return true if there are no frames', function() {
330
+ it('should return true if there are no frames', function () {
282
331
  var item = {
283
332
  level: 'critical',
284
- body: {trace: {frames: []}}
333
+ body: { trace: { frames: [] } },
285
334
  };
286
335
  var traceChainItem = {
287
336
  level: 'critical',
288
- body: {trace_chain: [
289
- {frames: []},
290
- {frames: []}
291
- ]}
337
+ body: { trace_chain: [{ frames: [] }, { frames: [] }] },
292
338
  };
293
339
  var settings = {
294
340
  reportLevel: 'debug',
295
- hostBlockList: ['nope.com']
341
+ hostBlockList: ['nope.com'],
296
342
  };
297
343
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
298
344
  expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
299
345
  });
300
- it('should return true if nothing in the blocklist matches', function() {
346
+ it('should return true if nothing in the blocklist matches', function () {
301
347
  var settings = {
302
348
  reportLevel: 'debug',
303
- hostBlockList: ['baz\.com', 'foo\.com']
349
+ hostBlockList: ['baz.com', 'foo.com'],
304
350
  };
305
351
  expect(p.urlIsNotBlockListed(logger)(item, settings)).to.be.ok();
306
352
  expect(p.urlIsNotBlockListed(logger)(traceChainItem, settings)).to.be.ok();
307
353
  });
308
354
  });
309
355
 
310
- describe('messageIsIgnored', function() {
311
- it('true if no ignoredMessages setting', function() {
356
+ describe('messageIsIgnored', function () {
357
+ it('true if no ignoredMessages setting', function () {
312
358
  var item = {
313
359
  level: 'critical',
314
360
  body: {
315
- trace: {exception: {message: 'bork bork'}},
316
- message: {body: 'fuzz'}
317
- }
361
+ trace: { exception: { message: 'bork bork' } },
362
+ message: { body: 'fuzz' },
363
+ },
318
364
  };
319
365
  var settings = {
320
- reportLevel: 'debug'
366
+ reportLevel: 'debug',
321
367
  };
322
368
  expect(p.messageIsIgnored(logger)(item, settings)).to.be.ok();
323
369
  });
324
- it('true if ignoredMessages is empty', function() {
370
+ it('true if ignoredMessages is empty', function () {
325
371
  var item = {
326
372
  level: 'critical',
327
373
  body: {
328
- trace: {exception: {message: 'bork bork'}},
329
- message: {body: 'fuzz'}
330
- }
374
+ trace: { exception: { message: 'bork bork' } },
375
+ message: { body: 'fuzz' },
376
+ },
331
377
  };
332
378
  var settings = {
333
379
  reportLevel: 'debug',
334
- ignoredMessages: []
380
+ ignoredMessages: [],
335
381
  };
336
382
  expect(p.messageIsIgnored(logger)(item, settings)).to.be.ok();
337
383
  });
338
- it('true if no exception message', function() {
384
+ it('true if no exception message', function () {
339
385
  var item = {
340
386
  level: 'critical',
341
387
  body: {
342
- trace: {exception: {}},
343
- message: 'fuzz'
344
- }
388
+ trace: { exception: {} },
389
+ message: 'fuzz',
390
+ },
345
391
  };
346
392
  var settings = {
347
393
  reportLevel: 'debug',
348
- ignoredMessages: ['bork bork', 'fuzz']
394
+ ignoredMessages: ['bork bork', 'fuzz'],
349
395
  };
350
396
  expect(p.messageIsIgnored(logger)(item, settings)).to.be.ok();
351
397
  });
352
- it('true if no ignoredMessages match', function() {
398
+ it('true if no ignoredMessages match', function () {
353
399
  var item = {
354
400
  level: 'critical',
355
401
  body: {
356
- trace: {exception: {message: 'bork bork'}},
357
- message: {body: 'fuzz'}
358
- }
402
+ trace: { exception: { message: 'bork bork' } },
403
+ message: { body: 'fuzz' },
404
+ },
359
405
  };
360
406
  var settings = {
361
407
  reportLevel: 'debug',
362
- ignoredMessages: ['fake', 'stuff']
408
+ ignoredMessages: ['fake', 'stuff'],
363
409
  };
364
410
  expect(p.messageIsIgnored(logger)(item, settings)).to.be.ok();
365
411
  });
366
- it('false if any ignoredMessages match', function() {
412
+ it('false if any ignoredMessages match', function () {
367
413
  var item = {
368
414
  level: 'critical',
369
415
  body: {
370
- trace: {exception: {message: 'bork bork'}},
371
- message: {body: 'fuzz'}
372
- }
416
+ trace: { exception: { message: 'bork bork' } },
417
+ message: { body: 'fuzz' },
418
+ },
373
419
  };
374
420
  var settings = {
375
421
  reportLevel: 'debug',
376
- ignoredMessages: ['bork bork', 'stuff']
422
+ ignoredMessages: ['bork bork', 'stuff'],
377
423
  };
378
424
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
379
425
  });
380
- it('false if ignoredMessages regex match', function() {
426
+ it('false if ignoredMessages regex match', function () {
381
427
  var item = {
382
428
  level: 'critical',
383
429
  body: {
384
- message: {body: 'This is an ignored message'}
385
- }
430
+ message: { body: 'This is an ignored message' },
431
+ },
386
432
  };
387
433
  var settings = {
388
434
  reportLevel: 'debug',
389
- ignoredMessages: ['^This is an .{7} message$']
435
+ ignoredMessages: ['^This is an .{7} message$'],
390
436
  };
391
437
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
392
438
  });
393
- it('false if ignoredMessages literal match', function() {
439
+ it('false if ignoredMessages literal match', function () {
394
440
  var item = {
395
441
  level: 'critical',
396
442
  body: {
397
- message: {body: '{"data":{"messages":[{"message":"Unauthorized"}]}}'}
398
- }
443
+ message: { body: '{"data":{"messages":[{"message":"Unauthorized"}]}}' },
444
+ },
399
445
  };
400
446
  var settings = {
401
447
  reportLevel: 'debug',
402
- ignoredMessages: ['{"data":{"messages":\\[']
448
+ ignoredMessages: ['{"data":{"messages":\\['],
403
449
  };
404
450
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
405
451
  });
406
- it('false if ignoredMessages more literal regex matches', function() {
452
+ it('false if ignoredMessages more literal regex matches', function () {
407
453
  var item = {
408
454
  level: 'critical',
409
455
  body: {
410
- message: {body: 'Match these characters: (*+?)'}
411
- }
456
+ message: { body: 'Match these characters: (*+?)' },
457
+ },
412
458
  };
413
459
  var settings = {
414
460
  reportLevel: 'debug',
415
- ignoredMessages: ['\\(\\*\\+\\?\\)']
461
+ ignoredMessages: ['\\(\\*\\+\\?\\)'],
416
462
  };
417
463
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
418
464
  });
419
- it('false if both trace and body message but ignoredMessages only match body', function() {
465
+ it('false if both trace and body message but ignoredMessages only match body', function () {
420
466
  var item = {
421
467
  level: 'critical',
422
468
  body: {
423
- trace: {exception: {message: 'bork bork'}},
424
- message: {body: 'fuzz'}
425
- }
469
+ trace: { exception: { message: 'bork bork' } },
470
+ message: { body: 'fuzz' },
471
+ },
426
472
  };
427
473
  var settings = {
428
474
  reportLevel: 'debug',
429
- ignoredMessages: ['fuzz', 'stuff']
475
+ ignoredMessages: ['fuzz', 'stuff'],
430
476
  };
431
477
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
432
478
  });
433
- it('false if ignoredMessages match something in body exception message', function() {
479
+ it('false if ignoredMessages match something in body exception message', function () {
434
480
  var item = {
435
481
  level: 'critical',
436
482
  body: {
437
- trace: {frames: []},
438
- message: {body: 'fuzz'}
439
- }
483
+ trace: { frames: [] },
484
+ message: { body: 'fuzz' },
485
+ },
440
486
  };
441
487
  var settings = {
442
488
  reportLevel: 'debug',
443
- ignoredMessages: ['stuff', 'fuzz']
489
+ ignoredMessages: ['stuff', 'fuzz'],
444
490
  };
445
491
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
446
492
  });
447
- it("true if trace_chain doesn't match", function() {
493
+ it("true if trace_chain doesn't match", function () {
448
494
  var item = {
449
495
  level: 'critical',
450
496
  body: {
451
497
  trace_chain: [
452
- {exception: {message: 'inner bork'}},
453
- {exception: {message: 'outer bork'}}
454
- ]
455
- }
498
+ { exception: { message: 'inner bork' } },
499
+ { exception: { message: 'outer bork' } },
500
+ ],
501
+ },
456
502
  };
457
503
  var settings = {
458
504
  reportLevel: 'debug',
459
- ignoredMessages: ['stuff', 'fuzz']
505
+ ignoredMessages: ['stuff', 'fuzz'],
460
506
  };
461
507
  expect(p.messageIsIgnored(logger)(item, settings)).to.be.ok();
462
508
  });
463
- it("false if first trace_chain trace matches", function() {
509
+ it('false if first trace_chain trace matches', function () {
464
510
  var item = {
465
511
  level: 'critical',
466
512
  body: {
467
513
  trace_chain: [
468
- {exception: {message: 'inner stuff'}},
469
- {exception: {message: 'outer bork'}}
470
- ]
471
- }
514
+ { exception: { message: 'inner stuff' } },
515
+ { exception: { message: 'outer bork' } },
516
+ ],
517
+ },
472
518
  };
473
519
  var settings = {
474
520
  reportLevel: 'debug',
475
- ignoredMessages: ['stuff', 'fuzz']
521
+ ignoredMessages: ['stuff', 'fuzz'],
476
522
  };
477
523
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
478
524
  });
479
- it("false if last trace_chain trace matches", function() {
525
+ it('false if last trace_chain trace matches', function () {
480
526
  var item = {
481
527
  level: 'critical',
482
528
  body: {
483
529
  trace_chain: [
484
- {exception: {message: 'inner bork'}},
485
- {exception: {message: 'outer fuzz'}}
486
- ]
487
- }
530
+ { exception: { message: 'inner bork' } },
531
+ { exception: { message: 'outer fuzz' } },
532
+ ],
533
+ },
488
534
  };
489
535
  var settings = {
490
536
  reportLevel: 'debug',
491
- ignoredMessages: ['stuff', 'fuzz']
537
+ ignoredMessages: ['stuff', 'fuzz'],
492
538
  };
493
539
  expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
494
540
  });