1- import type { LRUMap } from '@sentry/utils' ;
21import type { Debugger , InspectorNotification } from 'inspector' ;
32
43import { NodeClient , defaultStackParser } from '../../src' ;
5- import { createRateLimiter } from '../../src/integrations/localvariables /common' ;
6- import type { FrameVariables } from '../../src/integrations/localvariables /common' ;
7- import type { DebugSession } from '../../src/integrations/localvariables/localvariables -sync' ;
8- import { LocalVariablesSync , createCallbackList } from '../../src/integrations/localvariables/localvariables -sync' ;
4+ import { createRateLimiter } from '../../src/integrations/local-variables /common' ;
5+ import type { FrameVariables } from '../../src/integrations/local-variables /common' ;
6+ import type { DebugSession } from '../../src/integrations/local-variables/local-variables -sync' ;
7+ import { LocalVariablesSync , createCallbackList } from '../../src/integrations/local-variables/local-variables -sync' ;
98import { NODE_VERSION } from '../../src/nodeVersion' ;
109import { getDefaultNodeClientOptions } from '../../test/helper/node-client-options' ;
1110
@@ -52,7 +51,8 @@ class MockDebugSession implements DebugSession {
5251}
5352
5453interface LocalVariablesPrivate {
55- _cachedFrames : LRUMap < string , FrameVariables [ ] > ;
54+ _getCachedFramesCount ( ) : number ;
55+ _getFirstCachedFrame ( ) : FrameVariables [ ] | undefined ;
5656}
5757
5858const exceptionEvent = {
@@ -175,9 +175,9 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
175175
176176 await session . runPause ( exceptionEvent ) ;
177177
178- expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . size ) . toBe ( 1 ) ;
178+ expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _getCachedFramesCount ( ) ) . toBe ( 1 ) ;
179179
180- const frames : FrameVariables [ ] = ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . values ( ) [ 0 ] ;
180+ const frames = ( localVariables as unknown as LocalVariablesPrivate ) . _getFirstCachedFrame ( ) ;
181181
182182 expect ( frames ) . toBeDefined ( ) ;
183183
@@ -244,7 +244,7 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
244244 expect ( event ?. exception ?. values ?. [ 0 ] . stacktrace ?. frames ?. [ 3 ] ?. vars ) . toEqual ( { arr : [ 1 , 2 , 3 ] } ) ;
245245 expect ( event ?. exception ?. values ?. [ 0 ] . stacktrace ?. frames ?. [ 4 ] ?. vars ) . toEqual ( { name : 'tim' } ) ;
246246
247- expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . size ) . toBe ( 0 ) ;
247+ expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _getCachedFramesCount ( ) ) . toBe ( 0 ) ;
248248 } ) ;
249249
250250 it ( 'Only considers the first 5 frames' , async ( ) => {
@@ -261,9 +261,9 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
261261
262262 await session . runPause ( exceptionEvent100Frames ) ;
263263
264- expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . size ) . toBe ( 1 ) ;
264+ expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _getCachedFramesCount ( ) ) . toBe ( 1 ) ;
265265
266- const frames : FrameVariables [ ] = ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . values ( ) [ 0 ] ;
266+ const frames = ( localVariables as unknown as LocalVariablesPrivate ) . _getFirstCachedFrame ( ) ;
267267
268268 expect ( frames ) . toBeDefined ( ) ;
269269
@@ -291,7 +291,7 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
291291
292292 await session . runPause ( nonExceptionEvent ) ;
293293
294- expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . size ) . toBe ( 0 ) ;
294+ expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _getCachedFramesCount ( ) ) . toBe ( 0 ) ;
295295 } ) ;
296296
297297 it ( 'Should not initialize when disabled' , async ( ) => {
@@ -309,7 +309,6 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
309309 const eventProcessor = eventProcessors . find ( processor => processor . id === 'LocalVariablesSync' ) ;
310310
311311 expect ( eventProcessor ) . toBeDefined ( ) ;
312- expect ( localVariables [ '_shouldProcessEvent' ] ) . toBe ( false ) ;
313312 } ) ;
314313
315314 it ( 'Should not initialize when inspector not loaded' , async ( ) => {
@@ -326,7 +325,6 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
326325 const eventProcessor = eventProcessors . find ( processor => processor . id === 'LocalVariablesSync' ) ;
327326
328327 expect ( eventProcessor ) . toBeDefined ( ) ;
329- expect ( localVariables [ '_shouldProcessEvent' ] ) . toBe ( false ) ;
330328 } ) ;
331329
332330 it ( 'Should cache identical uncaught exception events' , async ( ) => {
@@ -350,7 +348,7 @@ describeIf(NODE_VERSION.major >= 18)('LocalVariables', () => {
350348 await session . runPause ( exceptionEvent ) ;
351349 await session . runPause ( exceptionEvent ) ;
352350
353- expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _cachedFrames . size ) . toBe ( 1 ) ;
351+ expect ( ( localVariables as unknown as LocalVariablesPrivate ) . _getCachedFramesCount ( ) ) . toBe ( 1 ) ;
354352 } ) ;
355353
356354 describe ( 'createCallbackList' , ( ) => {
0 commit comments