@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
2
2
import type { StackFrame } from '@sentry/types' ;
3
3
import { parseStackFrames } from '@sentry/utils' ;
4
4
5
- import { _contextLinesIntegration , resetFileContentCache , MAX_CONTEXTLINES_COLNO } from '../../src/integrations/contextlines' ;
5
+ import { _contextLinesIntegration , resetFileContentCache , MAX_CONTEXTLINES_COLNO , MAX_CONTEXTLINES_LINENO } from '../../src/integrations/contextlines' ;
6
6
import { defaultStackParser } from '../../src/sdk/api' ;
7
7
import { getError } from '../helpers/error' ;
8
8
@@ -23,7 +23,7 @@ describe('ContextLines', () => {
23
23
} ) ;
24
24
25
25
describe ( 'limits' , ( ) => {
26
- test ( ' colno limit' , async ( ) => {
26
+ test ( ` colno above ${ MAX_CONTEXTLINES_COLNO } ` , async ( ) => {
27
27
expect . assertions ( 1 ) ;
28
28
const frames : StackFrame [ ] = [
29
29
{
@@ -38,6 +38,22 @@ describe('ContextLines', () => {
38
38
await addContext ( frames ) ;
39
39
expect ( readStreamSpy ) . not . toHaveBeenCalled ( ) ;
40
40
} )
41
+
42
+ test ( `lineno above ${ MAX_CONTEXTLINES_LINENO } ` , async ( ) => {
43
+ expect . assertions ( 1 ) ;
44
+ const frames : StackFrame [ ] = [
45
+ {
46
+ colno : 1 ,
47
+ filename : 'file:///var/task/index.js' ,
48
+ lineno : MAX_CONTEXTLINES_LINENO + 1 ,
49
+ function : 'fxn1' ,
50
+ } ,
51
+ ] ;
52
+
53
+ const readStreamSpy = jest . spyOn ( fs , 'createReadStream' ) ;
54
+ await addContext ( frames ) ;
55
+ expect ( readStreamSpy ) . not . toHaveBeenCalled ( ) ;
56
+ } )
41
57
} )
42
58
43
59
describe ( 'lru file cache' , ( ) => {
0 commit comments