@@ -246,12 +246,6 @@ describe('globals', function() {
246
246
247
247
describe ( 'normalizeFrame' , function ( ) {
248
248
it ( 'should handle a normal frame' , function ( ) {
249
- var context = [
250
- [ 'line1' ] , // pre
251
- 'line2' , // culprit
252
- [ 'line3' ] // post
253
- ] ;
254
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( context ) ;
255
249
var frame = {
256
250
url : 'http://example.com/path/file.js' ,
257
251
line : 10 ,
@@ -267,25 +261,18 @@ describe('globals', function() {
267
261
lineno : 10 ,
268
262
colno : 11 ,
269
263
'function' : 'lol' ,
270
- pre_context : [ 'line1' ] ,
271
- context_line : 'line2' ,
272
- post_context : [ 'line3' ] ,
273
264
in_app : true
274
265
} ) ;
275
266
} ) ;
276
267
277
268
it ( 'should handle a frame without context' , function ( ) {
278
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
279
269
var frame = {
280
270
url : 'http://example.com/path/file.js' ,
281
271
line : 10 ,
282
272
column : 11 ,
283
273
func : 'lol'
284
- // context: [] context is stubbed
285
274
} ;
286
275
287
- Raven . _globalOptions . fetchContext = true ;
288
-
289
276
assert . deepEqual ( Raven . _normalizeFrame ( frame ) , {
290
277
filename : 'http://example.com/path/file.js' ,
291
278
lineno : 10 ,
@@ -296,13 +283,11 @@ describe('globals', function() {
296
283
} ) ;
297
284
298
285
it ( 'should not mark `in_app` if rules match' , function ( ) {
299
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
300
286
var frame = {
301
287
url : 'http://example.com/path/file.js' ,
302
288
line : 10 ,
303
289
column : 11 ,
304
290
func : 'lol'
305
- // context: [] context is stubbed
306
291
} ;
307
292
308
293
Raven . _globalOptions . fetchContext = true ;
@@ -318,13 +303,11 @@ describe('globals', function() {
318
303
} ) ;
319
304
320
305
it ( 'should mark `in_app` if rules do not match' , function ( ) {
321
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
322
306
var frame = {
323
307
url : 'http://lol.com/path/file.js' ,
324
308
line : 10 ,
325
309
column : 11 ,
326
310
func : 'lol'
327
- // context: [] context is stubbed
328
311
} ;
329
312
330
313
Raven . _globalOptions . fetchContext = true ;
@@ -340,13 +323,11 @@ describe('globals', function() {
340
323
} ) ;
341
324
342
325
it ( 'should mark `in_app` for raven.js' , function ( ) {
343
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
344
326
var frame = {
345
327
url : 'http://lol.com/path/raven.js' ,
346
328
line : 10 ,
347
329
column : 11 ,
348
330
func : 'lol'
349
- // context: [] context is stubbed
350
331
} ;
351
332
352
333
assert . deepEqual ( Raven . _normalizeFrame ( frame ) , {
@@ -359,13 +340,11 @@ describe('globals', function() {
359
340
} ) ;
360
341
361
342
it ( 'should mark `in_app` for raven.min.js' , function ( ) {
362
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
363
343
var frame = {
364
344
url : 'http://lol.com/path/raven.min.js' ,
365
345
line : 10 ,
366
346
column : 11 ,
367
347
func : 'lol'
368
- // context: [] context is stubbed
369
348
} ;
370
349
371
350
assert . deepEqual ( Raven . _normalizeFrame ( frame ) , {
@@ -378,13 +357,11 @@ describe('globals', function() {
378
357
} ) ;
379
358
380
359
it ( 'should mark `in_app` for Raven' , function ( ) {
381
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
382
360
var frame = {
383
361
url : 'http://lol.com/path/file.js' ,
384
362
line : 10 ,
385
363
column : 11 ,
386
364
func : 'Raven.wrap'
387
- // context: [] context is stubbed
388
365
} ;
389
366
390
367
assert . deepEqual ( Raven . _normalizeFrame ( frame ) , {
@@ -397,13 +374,11 @@ describe('globals', function() {
397
374
} ) ;
398
375
399
376
it ( 'should mark `in_app` for TraceKit' , function ( ) {
400
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
401
377
var frame = {
402
378
url : 'http://lol.com/path/file.js' ,
403
379
line : 10 ,
404
380
column : 11 ,
405
381
func : 'TraceKit.lol'
406
- // context: [] context is stubbed
407
382
} ;
408
383
409
384
assert . deepEqual ( Raven . _normalizeFrame ( frame ) , {
@@ -416,95 +391,17 @@ describe('globals', function() {
416
391
} ) ;
417
392
418
393
it ( 'should not blow up if includePaths is empty, regression for #377' , function ( ) {
419
- this . sinon . stub ( Raven , '_extractContextFromFrame' ) . returns ( undefined ) ;
420
394
var frame = {
421
395
url : 'http://lol.com/path/file.js' ,
422
396
line : 10 ,
423
397
column : 11 ,
424
398
func : 'TraceKit.lol'
425
- // context: [] context is stubbed
426
399
} ;
427
400
Raven . _globalOptions . includePaths = [ ] ;
428
401
Raven . _normalizeFrame ( frame ) ;
429
402
} ) ;
430
403
} ) ;
431
404
432
- describe ( 'extractContextFromFrame' , function ( ) {
433
- it ( 'should handle a normal frame' , function ( ) {
434
- var frame = {
435
- column : 2 ,
436
- context : [
437
- 'line1' ,
438
- 'line2' ,
439
- 'line3' ,
440
- 'line4' ,
441
- 'line5' ,
442
- 'culprit' ,
443
- 'line7' ,
444
- 'line8' ,
445
- 'line9' ,
446
- 'line10' ,
447
- 'line11'
448
- ]
449
- } ;
450
- var context = Raven . _extractContextFromFrame ( frame ) ;
451
- assert . deepEqual ( context , [
452
- [ 'line1' , 'line2' , 'line3' , 'line4' , 'line5' ] ,
453
- 'culprit' ,
454
- [ 'line7' , 'line8' , 'line9' , 'line10' , 'line11' ]
455
- ] ) ;
456
- } ) ;
457
-
458
- it ( 'should return nothing if there is no context' , function ( ) {
459
- var frame = {
460
- column : 2
461
- } ;
462
- assert . isUndefined ( Raven . _extractContextFromFrame ( frame ) ) ;
463
- } ) ;
464
-
465
- it ( 'should reject a context if a line is too long without a column' , function ( ) {
466
- var frame = {
467
- context : [
468
- new Array ( 1000 ) . join ( 'f' ) // generate a line that is 1000 chars long
469
- ]
470
- } ;
471
- assert . isUndefined ( Raven . _extractContextFromFrame ( frame ) ) ;
472
- } ) ;
473
-
474
- it ( 'should reject a minified context with fetchContext disabled' , function ( ) {
475
- var frame = {
476
- column : 2 ,
477
- context : [
478
- 'line1' ,
479
- 'line2' ,
480
- 'line3' ,
481
- 'line4' ,
482
- 'line5' ,
483
- 'culprit' ,
484
- 'line7' ,
485
- 'line8' ,
486
- 'line9' ,
487
- 'line10' ,
488
- 'line11'
489
- ]
490
- } ;
491
- Raven . _globalOptions . fetchContext = false ;
492
- assert . isUndefined ( Raven . _extractContextFromFrame ( frame ) ) ;
493
- } ) ;
494
-
495
- it ( 'should truncate the minified line if there is a column number without sourcemaps enabled' , function ( ) {
496
- // Note to future self:
497
- // Array(51).join('f').length === 50
498
- var frame = {
499
- column : 2 ,
500
- context : [
501
- 'aa' + ( new Array ( 51 ) . join ( 'f' ) ) + ( new Array ( 500 ) . join ( 'z' ) )
502
- ]
503
- } ;
504
- assert . deepEqual ( Raven . _extractContextFromFrame ( frame ) , [ [ ] , new Array ( 51 ) . join ( 'f' ) , [ ] ] ) ;
505
- } ) ;
506
- } ) ;
507
-
508
405
describe ( 'processException' , function ( ) {
509
406
it ( 'should respect `ignoreErrors`' , function ( ) {
510
407
this . sinon . stub ( Raven , '_send' ) ;
0 commit comments