rollbar 2.26.3 → 3.0.0-alpha.1

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 (186) hide show
  1. package/.cursor/rules/guidelines.mdc +154 -0
  2. package/.github/workflows/ci.yml +32 -12
  3. package/.lgtm.yml +7 -7
  4. package/.prettierignore +18 -0
  5. package/.vscode/settings.json +39 -0
  6. package/CHANGELOG.md +121 -35
  7. package/CLAUDE.md +201 -0
  8. package/Gruntfile.js +101 -48
  9. package/Makefile +3 -3
  10. package/README.md +2 -4
  11. package/SECURITY.md +5 -0
  12. package/babel.config.json +9 -0
  13. package/bower.json +1 -3
  14. package/codex.md +148 -0
  15. package/defaults.js +17 -5
  16. package/dist/plugins/jquery.min.js +1 -1
  17. package/dist/rollbar.js +18748 -5375
  18. package/dist/rollbar.js.map +1 -1
  19. package/dist/rollbar.min.js +2 -1
  20. package/dist/rollbar.min.js.LICENSE.txt +1 -0
  21. package/dist/rollbar.min.js.map +1 -1
  22. package/dist/rollbar.named-amd.js +19368 -6000
  23. package/dist/rollbar.named-amd.js.map +1 -1
  24. package/dist/rollbar.named-amd.min.js +3 -1
  25. package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -0
  26. package/dist/rollbar.named-amd.min.js.map +1 -1
  27. package/dist/rollbar.noconflict.umd.js +18749 -5380
  28. package/dist/rollbar.noconflict.umd.js.map +1 -1
  29. package/dist/rollbar.noconflict.umd.min.js +3 -1
  30. package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -0
  31. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  32. package/dist/rollbar.snippet.js +1 -1
  33. package/dist/rollbar.umd.js +19367 -6000
  34. package/dist/rollbar.umd.js.map +1 -1
  35. package/dist/rollbar.umd.min.js +3 -1
  36. package/dist/rollbar.umd.min.js.LICENSE.txt +1 -0
  37. package/dist/rollbar.umd.min.js.map +1 -1
  38. package/docs/extension-exceptions.md +35 -30
  39. package/docs/migration_v0_to_v1.md +41 -38
  40. package/eslint.config.mjs +33 -0
  41. package/get_versions.js +33 -0
  42. package/index.d.ts +270 -231
  43. package/karma.conf.js +18 -27
  44. package/package.json +21 -21
  45. package/prettier.config.js +7 -0
  46. package/src/api.js +78 -14
  47. package/src/apiUtility.js +14 -11
  48. package/src/browser/core.js +138 -72
  49. package/src/browser/defaults/scrubFields.js +3 -3
  50. package/src/browser/detection.js +7 -8
  51. package/src/browser/domUtility.js +18 -8
  52. package/src/browser/globalSetup.js +12 -6
  53. package/src/browser/logger.js +1 -1
  54. package/src/browser/plugins/jquery.js +35 -35
  55. package/src/browser/predicates.js +1 -1
  56. package/src/browser/replay/defaults.js +71 -0
  57. package/src/browser/replay/recorder.js +193 -0
  58. package/src/browser/replay/replayMap.js +195 -0
  59. package/src/browser/rollbar.js +12 -8
  60. package/src/browser/rollbarWrapper.js +8 -5
  61. package/src/browser/shim.js +43 -19
  62. package/src/browser/snippet_callback.js +6 -4
  63. package/src/browser/telemetry.js +573 -361
  64. package/src/browser/transforms.js +46 -27
  65. package/src/browser/transport/fetch.js +26 -14
  66. package/src/browser/transport/xhr.js +41 -14
  67. package/src/browser/transport.js +93 -33
  68. package/src/browser/url.js +16 -8
  69. package/src/browser/wrapGlobals.js +27 -8
  70. package/src/defaults.js +3 -3
  71. package/src/errorParser.js +14 -11
  72. package/src/merge.js +32 -23
  73. package/src/notifier.js +16 -13
  74. package/src/predicates.js +43 -23
  75. package/src/queue.js +133 -40
  76. package/src/rateLimiter.js +59 -18
  77. package/src/react-native/logger.js +1 -1
  78. package/src/react-native/rollbar.js +59 -55
  79. package/src/react-native/transforms.js +13 -9
  80. package/src/react-native/transport.js +44 -34
  81. package/src/rollbar.js +72 -21
  82. package/src/scrub.js +0 -1
  83. package/src/server/locals.js +69 -39
  84. package/src/server/logger.js +4 -4
  85. package/src/server/parser.js +72 -47
  86. package/src/server/rollbar.js +135 -56
  87. package/src/server/sourceMap/stackTrace.js +33 -18
  88. package/src/server/telemetry/urlHelpers.js +9 -11
  89. package/src/server/telemetry.js +68 -45
  90. package/src/server/transforms.js +37 -21
  91. package/src/server/transport.js +62 -32
  92. package/src/telemetry.js +162 -33
  93. package/src/tracing/context.js +24 -0
  94. package/src/tracing/contextManager.js +37 -0
  95. package/src/tracing/defaults.js +7 -0
  96. package/src/tracing/exporter.js +188 -0
  97. package/src/tracing/hrtime.js +98 -0
  98. package/src/tracing/id.js +24 -0
  99. package/src/tracing/session.js +55 -0
  100. package/src/tracing/span.js +92 -0
  101. package/src/tracing/spanProcessor.js +15 -0
  102. package/src/tracing/tracer.js +46 -0
  103. package/src/tracing/tracing.js +89 -0
  104. package/src/transforms.js +33 -21
  105. package/src/truncation.js +8 -5
  106. package/src/utility/headers.js +43 -43
  107. package/src/utility/replace.js +9 -0
  108. package/src/utility/traverse.js +1 -1
  109. package/src/utility.js +123 -52
  110. package/test/api.test.js +88 -41
  111. package/test/apiUtility.test.js +48 -50
  112. package/test/browser.core.test.js +142 -141
  113. package/test/browser.domUtility.test.js +53 -36
  114. package/test/browser.predicates.test.js +14 -14
  115. package/test/browser.replay.recorder.test.js +416 -0
  116. package/test/browser.rollbar.test.js +655 -515
  117. package/test/browser.telemetry.test.js +46 -39
  118. package/test/browser.transforms.test.js +164 -139
  119. package/test/browser.transport.test.js +59 -50
  120. package/test/browser.url.test.js +13 -12
  121. package/test/fixtures/locals.fixtures.js +245 -126
  122. package/test/fixtures/replay/index.js +20 -0
  123. package/test/fixtures/replay/payloads.fixtures.js +229 -0
  124. package/test/fixtures/replay/rrwebEvents.fixtures.js +251 -0
  125. package/test/fixtures/replay/rrwebSyntheticEvents.fixtures.js +328 -0
  126. package/test/notifier.test.js +91 -79
  127. package/test/predicates.test.js +261 -215
  128. package/test/queue.test.js +231 -215
  129. package/test/rateLimiter.test.js +51 -43
  130. package/test/react-native.rollbar.test.js +150 -116
  131. package/test/react-native.transforms.test.js +23 -25
  132. package/test/react-native.transport.test.js +26 -14
  133. package/test/replay/index.js +2 -0
  134. package/test/replay/integration/api.spans.test.js +136 -0
  135. package/test/replay/integration/e2e.test.js +228 -0
  136. package/test/replay/integration/index.js +9 -0
  137. package/test/replay/integration/queue.replayMap.test.js +332 -0
  138. package/test/replay/integration/replayMap.test.js +163 -0
  139. package/test/replay/integration/sessionRecording.test.js +390 -0
  140. package/test/replay/unit/api.postSpans.test.js +150 -0
  141. package/test/replay/unit/index.js +7 -0
  142. package/test/replay/unit/queue.replayMap.test.js +225 -0
  143. package/test/replay/unit/replayMap.test.js +348 -0
  144. package/test/replay/util/index.js +5 -0
  145. package/test/replay/util/mockRecordFn.js +80 -0
  146. package/test/server.lambda.mocha.test.mjs +172 -0
  147. package/test/server.locals.constructor.mocha.test.mjs +80 -0
  148. package/test/server.locals.error-handling.mocha.test.mjs +387 -0
  149. package/test/server.locals.merge.mocha.test.mjs +267 -0
  150. package/test/server.locals.test-utils.mjs +114 -0
  151. package/test/server.parser.mocha.test.mjs +87 -0
  152. package/test/server.predicates.mocha.test.mjs +63 -0
  153. package/test/server.rollbar.constructor.mocha.test.mjs +199 -0
  154. package/test/server.rollbar.handlers.mocha.test.mjs +253 -0
  155. package/test/server.rollbar.logging.mocha.test.mjs +326 -0
  156. package/test/server.rollbar.misc.mocha.test.mjs +44 -0
  157. package/test/server.rollbar.test-utils.mjs +57 -0
  158. package/test/server.telemetry.mocha.test.mjs +377 -0
  159. package/test/server.transforms.data.mocha.test.mjs +163 -0
  160. package/test/server.transforms.error.mocha.test.mjs +199 -0
  161. package/test/server.transforms.request.mocha.test.mjs +208 -0
  162. package/test/server.transforms.scrub.mocha.test.mjs +140 -0
  163. package/test/server.transforms.sourcemaps.mocha.test.mjs +122 -0
  164. package/test/server.transforms.test-utils.mjs +62 -0
  165. package/test/server.transport.mocha.test.mjs +269 -0
  166. package/test/telemetry.test.js +178 -38
  167. package/test/tracing/contextManager.test.js +28 -0
  168. package/test/tracing/exporter.toPayload.test.js +400 -0
  169. package/test/tracing/id.test.js +24 -0
  170. package/test/tracing/span.test.js +183 -0
  171. package/test/tracing/spanProcessor.test.js +73 -0
  172. package/test/tracing/tracing.test.js +105 -0
  173. package/test/transforms.test.js +70 -68
  174. package/test/truncation.test.js +57 -55
  175. package/test/utility.test.js +310 -228
  176. package/webpack.config.js +36 -70
  177. package/.eslintignore +0 -7
  178. package/.gitmodules +0 -3
  179. package/test/server.lambda.test.js +0 -177
  180. package/test/server.locals.test.js +0 -841
  181. package/test/server.parser.test.js +0 -72
  182. package/test/server.predicates.test.js +0 -89
  183. package/test/server.rollbar.test.js +0 -676
  184. package/test/server.telemetry.test.js +0 -318
  185. package/test/server.transforms.test.js +0 -1099
  186. package/test/server.transport.test.js +0 -201
@@ -0,0 +1,328 @@
1
+ /**
2
+ * Synthetic rrweb events created from type definitions
3
+ * These events are NOT from real recordings but are created based on the
4
+ * type definitions in @rrweb/types to ensure complete test coverage.
5
+ */
6
+
7
+ import {
8
+ EventType,
9
+ IncrementalSource,
10
+ MouseInteractions,
11
+ MediaInteractions,
12
+ PointerTypes,
13
+ } from '@rrweb/types';
14
+
15
+ /**
16
+ * Synthetic events created from type definitions for testing
17
+ * These cover sources and interactions not in the real recordings
18
+ */
19
+ export const syntheticEvents = {
20
+ domContentLoaded: {
21
+ type: EventType.DomContentLoaded,
22
+ data: {}, // Empty object confirmed in rrweb/src/record/index.ts
23
+ timestamp: 1744983335276,
24
+ },
25
+
26
+ load: {
27
+ type: EventType.Load,
28
+ data: {}, // Empty object confirmed in rrweb/src/record/index.ts
29
+ timestamp: 1744983335277,
30
+ },
31
+
32
+ touchMove: {
33
+ type: EventType.IncrementalSnapshot,
34
+ data: {
35
+ source: IncrementalSource.TouchMove,
36
+ positions: [
37
+ {
38
+ x: 150,
39
+ y: 200,
40
+ id: 20,
41
+ timeOffset: 0,
42
+ },
43
+ {
44
+ x: 160,
45
+ y: 210,
46
+ id: 20,
47
+ timeOffset: 100,
48
+ },
49
+ ],
50
+ },
51
+ timestamp: 1744983335300,
52
+ },
53
+
54
+ mediaInteractionPlay: {
55
+ type: EventType.IncrementalSnapshot,
56
+ data: {
57
+ source: IncrementalSource.MediaInteraction,
58
+ type: MediaInteractions.Play,
59
+ id: 45,
60
+ currentTime: 0,
61
+ },
62
+ timestamp: 1744983335310,
63
+ },
64
+
65
+ mediaInteractionPause: {
66
+ type: EventType.IncrementalSnapshot,
67
+ data: {
68
+ source: IncrementalSource.MediaInteraction,
69
+ type: MediaInteractions.Pause,
70
+ id: 45,
71
+ currentTime: 30.5,
72
+ },
73
+ timestamp: 1744983335320,
74
+ },
75
+
76
+ mediaInteractionSeeked: {
77
+ type: EventType.IncrementalSnapshot,
78
+ data: {
79
+ source: IncrementalSource.MediaInteraction,
80
+ type: MediaInteractions.Seeked,
81
+ id: 45,
82
+ currentTime: 60,
83
+ },
84
+ timestamp: 1744983335330,
85
+ },
86
+
87
+ mediaInteractionVolumeChange: {
88
+ type: EventType.IncrementalSnapshot,
89
+ data: {
90
+ source: IncrementalSource.MediaInteraction,
91
+ type: MediaInteractions.VolumeChange,
92
+ id: 45,
93
+ volume: 0.75,
94
+ muted: false,
95
+ },
96
+ timestamp: 1744983335340,
97
+ },
98
+
99
+ mediaInteractionRateChange: {
100
+ type: EventType.IncrementalSnapshot,
101
+ data: {
102
+ source: IncrementalSource.MediaInteraction,
103
+ type: MediaInteractions.RateChange,
104
+ id: 45,
105
+ playbackRate: 1.5,
106
+ },
107
+ timestamp: 1744983335350,
108
+ },
109
+
110
+ styleSheetRule: {
111
+ type: EventType.IncrementalSnapshot,
112
+ data: {
113
+ source: IncrementalSource.StyleSheetRule,
114
+ styleId: 3,
115
+ adds: [
116
+ {
117
+ rule: '.new-class { color: red; }',
118
+ index: 1,
119
+ },
120
+ ],
121
+ },
122
+ timestamp: 1744983335360,
123
+ },
124
+
125
+ canvasMutation: {
126
+ type: EventType.IncrementalSnapshot,
127
+ data: {
128
+ source: IncrementalSource.CanvasMutation,
129
+ id: 24,
130
+ type: 0, // 2D canvas mutation
131
+ commands: [
132
+ {
133
+ property: 'fillStyle',
134
+ args: ['#ff0000'],
135
+ setter: true,
136
+ },
137
+ {
138
+ property: 'fillRect',
139
+ args: [10, 10, 100, 100],
140
+ setter: false,
141
+ },
142
+ ],
143
+ },
144
+ timestamp: 1744983335370,
145
+ },
146
+
147
+ font: {
148
+ type: EventType.IncrementalSnapshot,
149
+ data: {
150
+ source: IncrementalSource.Font,
151
+ family: 'CustomFont',
152
+ fontSource: "url('path/to/font.woff2')",
153
+ buffer: false,
154
+ descriptors: {
155
+ style: 'normal',
156
+ weight: '400',
157
+ display: 'swap',
158
+ },
159
+ },
160
+ timestamp: 1744983335380,
161
+ },
162
+
163
+ log: {
164
+ type: EventType.IncrementalSnapshot,
165
+ data: {
166
+ source: IncrementalSource.Log,
167
+ level: 'info',
168
+ trace: [],
169
+ payload: ['Log message from application'],
170
+ },
171
+ timestamp: 1744983335390,
172
+ },
173
+
174
+ drag: {
175
+ type: EventType.IncrementalSnapshot,
176
+ data: {
177
+ source: IncrementalSource.Drag,
178
+ positions: [
179
+ {
180
+ x: 100,
181
+ y: 100,
182
+ id: 50,
183
+ timeOffset: 0,
184
+ },
185
+ {
186
+ x: 120,
187
+ y: 120,
188
+ id: 50,
189
+ timeOffset: 100,
190
+ },
191
+ {
192
+ x: 140,
193
+ y: 140,
194
+ id: 50,
195
+ timeOffset: 200,
196
+ },
197
+ ],
198
+ },
199
+ timestamp: 1744983335400,
200
+ },
201
+
202
+ styleDeclaration: {
203
+ type: EventType.IncrementalSnapshot,
204
+ data: {
205
+ source: IncrementalSource.StyleDeclaration,
206
+ id: 64,
207
+ index: [0],
208
+ set: {
209
+ property: 'color',
210
+ value: 'blue',
211
+ priority: 'important',
212
+ },
213
+ },
214
+ timestamp: 1744983335410,
215
+ },
216
+
217
+ adoptedStyleSheet: {
218
+ type: EventType.IncrementalSnapshot,
219
+ data: {
220
+ source: IncrementalSource.AdoptedStyleSheet,
221
+ id: 1,
222
+ styles: [
223
+ {
224
+ id: 1,
225
+ rules: [
226
+ {
227
+ cssText: 'body { margin: 0; padding: 0; }',
228
+ },
229
+ {
230
+ cssText: 'h1 { font-size: 24px; }',
231
+ },
232
+ ],
233
+ },
234
+ ],
235
+ },
236
+ timestamp: 1744983335420,
237
+ },
238
+
239
+ customElement: {
240
+ type: EventType.IncrementalSnapshot,
241
+ data: {
242
+ source: IncrementalSource.CustomElement,
243
+ id: 80,
244
+ mutations: [
245
+ {
246
+ type: 'attributes',
247
+ name: 'data-custom',
248
+ value: 'new-value',
249
+ },
250
+ ],
251
+ },
252
+ timestamp: 1744983335430,
253
+ },
254
+
255
+ mouseInteractionDblClick: {
256
+ type: EventType.IncrementalSnapshot,
257
+ data: {
258
+ source: IncrementalSource.MouseInteraction,
259
+ type: MouseInteractions.DblClick,
260
+ id: 73,
261
+ x: 200,
262
+ y: 300,
263
+ pointerType: PointerTypes.Mouse,
264
+ },
265
+ timestamp: 1744983335440,
266
+ },
267
+
268
+ mouseInteractionContextMenu: {
269
+ type: EventType.IncrementalSnapshot,
270
+ data: {
271
+ source: IncrementalSource.MouseInteraction,
272
+ type: MouseInteractions.ContextMenu,
273
+ id: 73,
274
+ x: 200,
275
+ y: 300,
276
+ pointerType: PointerTypes.Mouse,
277
+ },
278
+ timestamp: 1744983335450,
279
+ },
280
+
281
+ mouseInteractionFocus: {
282
+ type: EventType.IncrementalSnapshot,
283
+ data: {
284
+ source: IncrementalSource.MouseInteraction,
285
+ type: MouseInteractions.Focus,
286
+ id: 73,
287
+ pointerType: PointerTypes.Mouse,
288
+ },
289
+ timestamp: 1744983335460,
290
+ },
291
+
292
+ mouseInteractionBlur: {
293
+ type: EventType.IncrementalSnapshot,
294
+ data: {
295
+ source: IncrementalSource.MouseInteraction,
296
+ type: MouseInteractions.Blur,
297
+ id: 73,
298
+ pointerType: PointerTypes.Mouse,
299
+ },
300
+ timestamp: 1744983335470,
301
+ },
302
+
303
+ mouseInteractionTouchStart: {
304
+ type: EventType.IncrementalSnapshot,
305
+ data: {
306
+ source: IncrementalSource.MouseInteraction,
307
+ type: MouseInteractions.TouchStart,
308
+ id: 73,
309
+ x: 200,
310
+ y: 300,
311
+ pointerType: PointerTypes.Touch,
312
+ },
313
+ timestamp: 1744983335480,
314
+ },
315
+
316
+ mouseInteractionTouchEnd: {
317
+ type: EventType.IncrementalSnapshot,
318
+ data: {
319
+ source: IncrementalSource.MouseInteraction,
320
+ type: MouseInteractions.TouchEnd,
321
+ id: 73,
322
+ x: 200,
323
+ y: 300,
324
+ pointerType: PointerTypes.Touch,
325
+ },
326
+ timestamp: 1744983335490,
327
+ },
328
+ };
@@ -3,33 +3,33 @@
3
3
  /* globals it */
4
4
  /* globals sinon */
5
5
 
6
- var Notifier = require('../src/notifier');
6
+ import Notifier from '../src/notifier.js';
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.addTransform(function(i, o, cb) {
63
- expect(o.someBool).to.not.be.ok();
64
- cb(null, {a: 42, b: i.b});
65
- }).addTransform(function(i, o, cb) {
66
- expect(o.someBool).to.not.be.ok();
67
- cb(null, {a: i.a+1, b: i.b});
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() { return; });
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.addTransform(function(i, o, cb) {
153
- cb(null, {a: 42, b: i.b});
154
- }).addTransform(function(i, o, cb) {
155
- cb(null, {a: i.a+1, b: i.b});
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.addTransform(function(i, o, cb) {
177
- cb(error, null);
178
- }).addTransform(function(i, o, cb) {
179
- expect(false).to.be.ok(); // assert this is not called
180
- cb(null, {a: 42, b: i.b});
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.addTransform(function(i, o, cb) {
199
- cb(new Error('fizz buzz'), null);
200
- }).addTransform(function(i, o, cb) {
201
- expect(false).to.be.ok(); // assert this is not called
202
- cb(null, {a: 42, b: i.b});
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.addTransform(function(i, o, cb) {
218
- expect(o.someBool).to.be.ok();
219
- cb(null, {a: 42, b: i.b});
220
- }).addTransform(function(i, o, cb) {
221
- expect(o.someBool).to.be.ok();
222
- cb(null, {a: i.a+1, b: i.b});
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