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
@@ -12,13 +12,13 @@ function itemFromArgs(args) {
12
12
  }
13
13
 
14
14
  var fakeLogger = {
15
- error: function(){},
16
- log: function(){}
15
+ error: function () {},
16
+ log: function () {},
17
17
  };
18
18
 
19
- describe('itemToPayload', function() {
20
- it('ignores options.payload.body but merges in other payload options', function(done) {
21
- var args = ['a message', {custom: 'stuff'}];
19
+ describe('itemToPayload', function () {
20
+ it('ignores options.payload.body but merges in other payload options', function (done) {
21
+ var args = ['a message', { custom: 'stuff' }];
22
22
  var item = itemFromArgs(args);
23
23
  item.accessToken = 'abc123';
24
24
  item._isUncaught = true;
@@ -26,9 +26,9 @@ describe('itemToPayload', function() {
26
26
  item.data = {};
27
27
  var options = {
28
28
  endpoint: 'api.rollbar.com',
29
- payload: {body: 'hey', x: 42}
29
+ payload: { body: 'hey', x: 42 },
30
30
  };
31
- t.itemToPayload(item, options, function(e, i) {
31
+ t.itemToPayload(item, options, function (e, i) {
32
32
  expect(i._isUncaught).to.eql(item._isUncaught);
33
33
  expect(i._originalArgs).to.eql(item._originalArgs);
34
34
 
@@ -38,31 +38,31 @@ describe('itemToPayload', function() {
38
38
  done(e);
39
39
  });
40
40
  });
41
- it('ignores handles trailing slash in endpoint', function(done) {
42
- var args = ['a message', {custom: 'stuff'}];
41
+ it('ignores handles trailing slash in endpoint', function (done) {
42
+ var args = ['a message', { custom: 'stuff' }];
43
43
  var item = itemFromArgs(args);
44
44
  item.accessToken = 'abc123';
45
- item.data = {message: 'a message'};
45
+ item.data = { message: 'a message' };
46
46
  var options = {
47
- endpoint: 'api.rollbar.com/'
47
+ endpoint: 'api.rollbar.com/',
48
48
  };
49
- t.itemToPayload(item, options, function(e, i) {
49
+ t.itemToPayload(item, options, function (e, i) {
50
50
  expect(i.message).to.eql('a message');
51
51
  done(e);
52
52
  });
53
53
  });
54
54
  });
55
55
 
56
- describe('addPayloadOptions', function() {
57
- it('ignores options.payload.body but merges in other payload options', function(done) {
58
- var args = ['a message', {custom: 'stuff'}];
56
+ describe('addPayloadOptions', function () {
57
+ it('ignores options.payload.body but merges in other payload options', function (done) {
58
+ var args = ['a message', { custom: 'stuff' }];
59
59
  var item = itemFromArgs(args);
60
60
  item.accessToken = 'abc123';
61
61
  var options = {
62
62
  endpoint: 'api.rollbar.com',
63
- payload: {body: 'hey', x: 42}
63
+ payload: { body: 'hey', x: 42 },
64
64
  };
65
- t.addPayloadOptions(item, options, function(e, i) {
65
+ t.addPayloadOptions(item, options, function (e, i) {
66
66
  expect(i.data.body).to.not.eql('hey');
67
67
  expect(i.data.x).to.eql(42);
68
68
  done(e);
@@ -70,36 +70,36 @@ describe('addPayloadOptions', function() {
70
70
  });
71
71
  });
72
72
 
73
- describe('addTelemetryData', function() {
74
- it('adds the data to the right place if events exist', function(done) {
73
+ describe('addTelemetryData', function () {
74
+ it('adds the data to the right place if events exist', function (done) {
75
75
  var item = {
76
76
  data: {
77
77
  body: {
78
- message: 'hello world'
79
- }
78
+ message: 'hello world',
79
+ },
80
80
  },
81
81
  telemetryEvents: [
82
82
  {
83
83
  type: 'log',
84
84
  body: {
85
85
  subtype: 'console',
86
- message: 'bork'
86
+ message: 'bork',
87
87
  },
88
88
  timestamp_ms: 12345,
89
- level: 'info'
89
+ level: 'info',
90
90
  },
91
91
  {
92
92
  type: 'manual',
93
93
  body: {
94
- hello: 'world'
94
+ hello: 'world',
95
95
  },
96
96
  timestamp_ms: 88889,
97
- level: 'info'
98
- }
99
- ]
97
+ level: 'info',
98
+ },
99
+ ],
100
100
  };
101
101
  var options = {};
102
- t.addTelemetryData(item, options, function(e, i) {
102
+ t.addTelemetryData(item, options, function (e, i) {
103
103
  expect(i.data.body.telemetry.length).to.eql(2);
104
104
  expect(i.data.body.telemetry[0].type).to.eql('log');
105
105
  done(e);
@@ -107,17 +107,17 @@ describe('addTelemetryData', function() {
107
107
  });
108
108
  });
109
109
 
110
- describe('addConfiguredOptions', function() {
111
- it('adds the configured options', function(done) {
110
+ describe('addConfiguredOptions', function () {
111
+ it('adds the configured options', function (done) {
112
112
  var item = {
113
113
  data: {
114
114
  body: {
115
- message: 'hello world'
115
+ message: 'hello world',
116
116
  },
117
117
  notifier: {
118
118
  name: 'rollbar-js',
119
- }
120
- }
119
+ },
120
+ },
121
121
  };
122
122
  var options = {
123
123
  accessToken: 'abc123',
@@ -125,71 +125,73 @@ describe('addConfiguredOptions', function() {
125
125
  captureUncaught: true,
126
126
  _configuredOptions: {
127
127
  accessToken: 'abc123',
128
- captureUncaught: true
129
- }
128
+ captureUncaught: true,
129
+ },
130
130
  };
131
- t.addConfiguredOptions(item, options, function(e, i) {
132
- expect(i.data.notifier.configured_options).to.eql({ captureUncaught: true });
131
+ t.addConfiguredOptions(item, options, function (e, i) {
132
+ expect(i.data.notifier.configured_options).to.eql({
133
+ captureUncaught: true,
134
+ });
133
135
  done(e);
134
136
  });
135
137
  });
136
138
  });
137
139
 
138
- describe('userTransform', function() {
139
- it('calls user transform if is present and a function', function(done) {
140
+ describe('userTransform', function () {
141
+ it('calls user transform if is present and a function', function (done) {
140
142
  var args = ['a message'];
141
143
  var item = itemFromArgs(args);
142
144
  var options = {
143
145
  endpoint: 'api.rollbar.com',
144
- transform: function(newItem, item) {
146
+ transform: function (newItem, item) {
145
147
  newItem.origin = item;
146
148
  newItem.message = 'HELLO';
147
- }
149
+ },
148
150
  };
149
151
  var payload = {
150
152
  access_token: '123',
151
- data: item
153
+ data: item,
152
154
  };
153
155
  expect(payload.data.message).to.not.eql('HELLO');
154
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
156
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
155
157
  expect(i.data.origin).to.be.an('object');
156
158
  expect(i.data.message).to.eql('HELLO');
157
159
  done(e);
158
160
  });
159
161
  });
160
- it('does nothing if transform is not a function', function(done) {
162
+ it('does nothing if transform is not a function', function (done) {
161
163
  var args = ['a message'];
162
164
  var item = itemFromArgs(args);
163
165
  var options = {
164
166
  endpoint: 'api.rollbar.com',
165
- transform: 'hi there'
167
+ transform: 'hi there',
166
168
  };
167
169
  var payload = {
168
170
  access_token: '123',
169
- data: item
171
+ data: item,
170
172
  };
171
173
  expect(payload.data.message).to.not.eql('HELLO');
172
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
174
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
173
175
  expect(i.data.message).to.not.eql('HELLO');
174
176
  done(e);
175
177
  });
176
178
  });
177
- it('does nothing if transform throws', function(done) {
179
+ it('does nothing if transform throws', function (done) {
178
180
  var args = ['a message'];
179
181
  var item = itemFromArgs(args);
180
182
  var options = {
181
183
  endpoint: 'api.rollbar.com',
182
- transform: function(i) {
184
+ transform: function (i) {
183
185
  i.data.message = 'HELLO';
184
186
  throw 'bork';
185
- }
187
+ },
186
188
  };
187
189
  var payload = {
188
190
  access_token: '123',
189
- data: item
191
+ data: item,
190
192
  };
191
193
  expect(payload.data.message).to.not.eql('HELLO');
192
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
194
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
193
195
  expect(i.data.message).to.not.eql('HELLO');
194
196
  expect(options.transform).to.not.be.ok();
195
197
  done(e);
@@ -201,16 +203,16 @@ describe('userTransform', function() {
201
203
  var item = itemFromArgs(args);
202
204
  var payload = {
203
205
  access_token: '123',
204
- data: item
206
+ data: item,
205
207
  };
206
208
  var options = {
207
209
  endpoint: 'api.rollbar.com',
208
- transform: function(newItem) {
210
+ transform: function (newItem) {
209
211
  newItem.message = 'HELLO';
210
- return Promise.resolve()
211
- }
212
+ return Promise.resolve();
213
+ },
212
214
  };
213
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
215
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
214
216
  expect(i.data.message).to.eql('HELLO');
215
217
  done(e);
216
218
  });
@@ -222,15 +224,15 @@ describe('userTransform', function() {
222
224
  var item = itemFromArgs(args);
223
225
  var payload = {
224
226
  access_token: '123',
225
- data: item
227
+ data: item,
226
228
  };
227
229
  var options = {
228
230
  endpoint: 'api.rollbar.com',
229
- transform: function(newItem) {
231
+ transform: function (newItem) {
230
232
  return Promise.resolve({ message: 'HELLO' });
231
- }
233
+ },
232
234
  };
233
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
235
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
234
236
  expect(i.data.message).to.eql('HELLO');
235
237
  expect(i.data).to.not.eql(item);
236
238
  done(e);
@@ -241,18 +243,18 @@ describe('userTransform', function() {
241
243
  it('uses untransformed value if transform returns a promise that rejects', function (done) {
242
244
  var args = ['a message'];
243
245
  var item = itemFromArgs(args);
244
- var err = { message: "HELLO" };
246
+ var err = { message: 'HELLO' };
245
247
  var payload = {
246
248
  access_token: '123',
247
- data: item
249
+ data: item,
248
250
  };
249
251
  var options = {
250
252
  endpoint: 'api.rollbar.com',
251
- transform: function(newItem) {
253
+ transform: function (newItem) {
252
254
  return Promise.reject(err);
253
- }
255
+ },
254
256
  };
255
- (t.userTransform(fakeLogger))(payload, options, function(e, i) {
257
+ t.userTransform(fakeLogger)(payload, options, function (e, i) {
256
258
  expect(i.data.message).to.not.eql('HELLO');
257
259
  expect(i.data).to.eql(item);
258
260
  expect(e).to.eql(err);
@@ -6,8 +6,8 @@ var t = require('../src/truncation');
6
6
  var utility = require('../src/utility');
7
7
  utility.setupJSON();
8
8
 
9
- describe('truncate', function() {
10
- it('should not truncate something small enough', function() {
9
+ describe('truncate', function () {
10
+ it('should not truncate something small enough', function () {
11
11
  var payload = messagePayload('hello world');
12
12
  var result = t.truncate(payload);
13
13
  expect(result.value).to.be.ok();
@@ -16,7 +16,7 @@ describe('truncate', function() {
16
16
  expect(resultValue).to.eql(payload);
17
17
  });
18
18
 
19
- it('should try all strategies if payload too big', function() {
19
+ it('should try all strategies if payload too big', function () {
20
20
  var payload = tracePayload(10, repeat('a', 500));
21
21
  var result = t.truncate(payload, undefined, 1);
22
22
  expect(result.value).to.be.ok();
@@ -24,11 +24,13 @@ describe('truncate', function() {
24
24
  var resultValue = JSON.parse(result.value);
25
25
 
26
26
  expect(resultValue.data.body.trace.exception.description).to.not.be.ok();
27
- expect(resultValue.data.body.trace.exception.message.length).to.be.below(256);
27
+ expect(resultValue.data.body.trace.exception.message.length).to.be.below(
28
+ 256,
29
+ );
28
30
  expect(resultValue.data.body.trace.frames.length).to.be.below(3);
29
31
  });
30
32
 
31
- it('should not truncate ascii payload close to max size', function() {
33
+ it('should not truncate ascii payload close to max size', function () {
32
34
  var payload = tracePayload(10, repeat('i', 500));
33
35
  var result = t.truncate(payload, undefined, 1100); // payload will be 500 + 528
34
36
  expect(result.value).to.be.ok();
@@ -37,7 +39,7 @@ describe('truncate', function() {
37
39
  expect(resultValue).to.eql(payload);
38
40
  });
39
41
 
40
- it('should truncate non-ascii payload when oversize', function() {
42
+ it('should truncate non-ascii payload when oversize', function () {
41
43
  var payload = tracePayload(10, repeat('あ', 500)); // あ is 3 utf-8 bytes (U+3042)
42
44
  var result = t.truncate(payload, undefined, 1100); // payload will be 1500 + 528
43
45
  expect(result.value).to.be.ok();
@@ -47,39 +49,39 @@ describe('truncate', function() {
47
49
  });
48
50
  });
49
51
 
50
- describe('raw', function() {
51
- it('should do nothing', function() {
52
+ describe('raw', function () {
53
+ it('should do nothing', function () {
52
54
  var payload = messagePayload('something');
53
55
  var rawResult = t.raw(payload);
54
56
  expect(rawResult[0]).to.eql(payload);
55
57
  });
56
58
  });
57
59
 
58
- describe('truncateFrames', function() {
59
- it('should do nothing with small number of frames', function() {
60
- var payload = tracePayload(5)
60
+ describe('truncateFrames', function () {
61
+ it('should do nothing with small number of frames', function () {
62
+ var payload = tracePayload(5);
61
63
  var result = t.truncateFrames(payload, undefined, 5);
62
64
  var resultP = result[0];
63
65
  expect(resultP.data.body.trace.frames.length).to.eql(5);
64
66
  });
65
67
 
66
- it('should cut out middle frames if too many', function() {
67
- var payload = tracePayload(20)
68
+ it('should cut out middle frames if too many', function () {
69
+ var payload = tracePayload(20);
68
70
  var result = t.truncateFrames(payload, undefined, 5);
69
71
  var resultP = result[0];
70
72
  expect(resultP.data.body.trace.frames.length).to.eql(10);
71
73
  });
72
74
 
73
- it('should do nothing with small number of frames trace_chain', function() {
74
- var payload = traceChainPayload(4, 5)
75
+ it('should do nothing with small number of frames trace_chain', function () {
76
+ var payload = traceChainPayload(4, 5);
75
77
  var result = t.truncateFrames(payload, undefined, 5);
76
78
  var resultP = result[0];
77
79
  expect(resultP.data.body.trace_chain[0].frames.length).to.eql(5);
78
80
  expect(resultP.data.body.trace_chain[3].frames.length).to.eql(5);
79
81
  });
80
82
 
81
- it('should cut out middle frames if too many trace_chain', function() {
82
- var payload = traceChainPayload(4, 20)
83
+ it('should cut out middle frames if too many trace_chain', function () {
84
+ var payload = traceChainPayload(4, 20);
83
85
  var result = t.truncateFrames(payload, undefined, 5);
84
86
  var resultP = result[0];
85
87
  expect(resultP.data.body.trace_chain[0].frames.length).to.eql(10);
@@ -87,8 +89,8 @@ describe('truncateFrames', function() {
87
89
  });
88
90
  });
89
91
 
90
- describe('truncateStrings', function() {
91
- it('should work recursively on different string sizes', function() {
92
+ describe('truncateStrings', function () {
93
+ it('should work recursively on different string sizes', function () {
92
94
  var payload = {
93
95
  access_token: 'abc',
94
96
  data: {
@@ -96,11 +98,11 @@ describe('truncateStrings', function() {
96
98
  small: 'i am a small string',
97
99
  big: repeat('hello world', 20),
98
100
  exact: repeat('a', 50),
99
- exactPlusOne: repeat('a', 51)
101
+ exactPlusOne: repeat('a', 51),
100
102
  },
101
103
  other: 'this is ok',
102
- not: repeat('too big', 30)
103
- }
104
+ not: repeat('too big', 30),
105
+ },
104
106
  };
105
107
 
106
108
  var result = t.truncateStrings(50, payload);
@@ -118,42 +120,42 @@ describe('truncateStrings', function() {
118
120
  });
119
121
  });
120
122
 
121
- describe('maybeTruncateValue', function() {
122
- it('should handle falsey things', function() {
123
+ describe('maybeTruncateValue', function () {
124
+ it('should handle falsey things', function () {
123
125
  expect(t.maybeTruncateValue(42, null)).to.be(null);
124
126
  expect(t.maybeTruncateValue(42, false)).to.eql(false);
125
127
  expect(t.maybeTruncateValue(42, undefined)).to.be(undefined);
126
128
  });
127
129
 
128
- it('should handle strings shorter than the length', function() {
130
+ it('should handle strings shorter than the length', function () {
129
131
  var len = 10;
130
132
  var val = 'hello';
131
133
  var result = t.maybeTruncateValue(len, val);
132
134
  expect(result).to.eql(val);
133
- expect(result.length).to.be.below(len+1);
135
+ expect(result.length).to.be.below(len + 1);
134
136
  });
135
- it('should handle strings longer than the length', function() {
137
+ it('should handle strings longer than the length', function () {
136
138
  var len = 10;
137
139
  var val = repeat('hello', 3);
138
140
  var result = t.maybeTruncateValue(len, val);
139
141
  expect(result).to.not.eql(val);
140
- expect(result.length).to.be.below(len+1);
142
+ expect(result.length).to.be.below(len + 1);
141
143
  });
142
- it('should handle arrays shorter than the length', function() {
144
+ it('should handle arrays shorter than the length', function () {
143
145
  var len = 10;
144
- var val = repeat('a,',8).split(',');
146
+ var val = repeat('a,', 8).split(',');
145
147
  val.pop();
146
148
  var result = t.maybeTruncateValue(len, val);
147
149
  expect(result).to.eql(val);
148
- expect(result.length).to.be.below(len+1);
150
+ expect(result.length).to.be.below(len + 1);
149
151
  });
150
- it('should handle arrays longer than the length', function() {
152
+ it('should handle arrays longer than the length', function () {
151
153
  var len = 10;
152
- var val = repeat('a,',12).split(',');
154
+ var val = repeat('a,', 12).split(',');
153
155
  val.pop();
154
156
  var result = t.maybeTruncateValue(len, val);
155
157
  expect(result).to.not.eql(val);
156
- expect(result.length).to.be.below(len+1);
158
+ expect(result.length).to.be.below(len + 1);
157
159
  });
158
160
  });
159
161
 
@@ -163,20 +165,20 @@ function messagePayload(message) {
163
165
  data: {
164
166
  body: {
165
167
  message: {
166
- body: message
167
- }
168
- }
169
- }
168
+ body: message,
169
+ },
170
+ },
171
+ },
170
172
  };
171
173
  }
172
174
 
173
175
  function tracePayload(frameCount, message) {
174
- message = (typeof message !== 'undefined') ? message : 'EXCEPTION MESSAGE';
176
+ message = typeof message !== 'undefined' ? message : 'EXCEPTION MESSAGE';
175
177
  var frames = [];
176
178
  for (var i = 0; i < frameCount; i++) {
177
179
  frames.push({
178
180
  filename: 'some/file/name',
179
- lineno: i
181
+ lineno: i,
180
182
  });
181
183
  }
182
184
  return {
@@ -186,41 +188,41 @@ function tracePayload(frameCount, message) {
186
188
  trace: {
187
189
  exception: {
188
190
  description: 'ALL YOUR BASE',
189
- message: message
191
+ message: message,
190
192
  },
191
- frames: frames
192
- }
193
- }
194
- }
193
+ frames: frames,
194
+ },
195
+ },
196
+ },
195
197
  };
196
198
  }
197
199
 
198
200
  function traceChainPayload(traceCount, frameCount, message) {
199
- message = (typeof message !== 'undefined') ? message : 'EXCEPTION MESSAGE';
201
+ message = typeof message !== 'undefined' ? message : 'EXCEPTION MESSAGE';
200
202
  var chain = [];
201
203
  for (var c = 0; c < traceCount; c++) {
202
204
  var frames = [];
203
205
  for (var i = 0; i < frameCount; i++) {
204
206
  frames.push({
205
- filename: 'some/file/name::'+c,
206
- lineno: i
207
+ filename: 'some/file/name::' + c,
208
+ lineno: i,
207
209
  });
208
210
  }
209
211
  chain.push({
210
212
  exception: {
211
213
  description: 'ALL YOUR BASE :: ' + c,
212
- message: message
214
+ message: message,
213
215
  },
214
- frames: frames
216
+ frames: frames,
215
217
  });
216
218
  }
217
219
  return {
218
220
  access_token: 'abc',
219
221
  data: {
220
222
  body: {
221
- trace_chain: chain
222
- }
223
- }
223
+ trace_chain: chain,
224
+ },
225
+ },
224
226
  };
225
227
  }
226
228