@@ -279,23 +279,6 @@ describe('Profiler Integration', () => {
279279 ] ) ,
280280 ) ;
281281 } ) ;
282-
283- it ( 'should not create performance entries when disabled' , async ( ) => {
284- profiler . setEnabled ( false ) ;
285-
286- expect ( profiler . measure ( 'disabled-sync' , ( ) => 'sync' ) ) . toBe ( 'sync' ) ;
287-
288- const asyncResult = profiler . measureAsync (
289- 'disabled-async' ,
290- async ( ) => 'async' ,
291- ) ;
292- await expect ( asyncResult ) . resolves . toBe ( 'async' ) ;
293-
294- profiler . marker ( 'disabled-marker' ) ;
295-
296- expect ( performance . getEntriesByType ( 'mark' ) ) . toHaveLength ( 0 ) ;
297- expect ( performance . getEntriesByType ( 'measure' ) ) . toHaveLength ( 0 ) ;
298- } ) ;
299282} ) ;
300283
301284describe ( 'NodeJS Profiler Integration' , ( ) => {
@@ -343,8 +326,8 @@ describe('NodeJS Profiler Integration', () => {
343326 } ) ;
344327
345328 it ( 'should disable profiling and close sink' , ( ) => {
346- nodejsProfiler . setEnabled ( false ) ;
347- expect ( nodejsProfiler . isEnabled ( ) ) . toBe ( false ) ;
329+ nodejsProfiler . stop ( ) ;
330+ expect ( nodejsProfiler . isRunning ( ) ) . toBe ( false ) ;
348331 expect ( mockSink . isClosed ( ) ) . toBe ( true ) ;
349332 expect ( mockSink . close ) . toHaveBeenCalledTimes ( 1 ) ;
350333
@@ -356,10 +339,10 @@ describe('NodeJS Profiler Integration', () => {
356339 } ) ;
357340
358341 it ( 'should re-enable profiling correctly' , ( ) => {
359- nodejsProfiler . setEnabled ( false ) ;
360- nodejsProfiler . setEnabled ( true ) ;
342+ nodejsProfiler . stop ( ) ;
343+ nodejsProfiler . start ( ) ;
361344
362- expect ( nodejsProfiler . isEnabled ( ) ) . toBe ( true ) ;
345+ expect ( nodejsProfiler . isRunning ( ) ) . toBe ( true ) ;
363346 expect ( mockSink . isClosed ( ) ) . toBe ( false ) ;
364347 expect ( mockSink . open ) . toHaveBeenCalledTimes ( 2 ) ;
365348
@@ -396,14 +379,14 @@ describe('NodeJS Profiler Integration', () => {
396379 } ) ;
397380
398381 const bufferedStats = bufferedProfiler . getStats ( ) ;
399- expect ( bufferedStats . enabled ) . toBe ( true ) ;
382+ expect ( bufferedStats . state ) . toBe ( 'running' ) ;
400383 expect ( bufferedStats . walOpen ) . toBe ( true ) ;
401384 expect ( bufferedStats . isSubscribed ) . toBe ( true ) ;
402385 expect ( bufferedStats . queued ) . toBe ( 0 ) ;
403386 expect ( bufferedStats . dropped ) . toBe ( 0 ) ;
404387 expect ( bufferedStats . written ) . toBe ( 0 ) ;
405388
406- bufferedProfiler . setEnabled ( false ) ;
389+ bufferedProfiler . stop ( ) ;
407390 } ) ;
408391
409392 it ( 'should return correct getStats with dropped and written counts' , ( ) => {
@@ -420,14 +403,14 @@ describe('NodeJS Profiler Integration', () => {
420403 expect ( statsProfiler . measure ( 'test-op' , ( ) => 'result' ) ) . toBe ( 'result' ) ;
421404
422405 const stats = statsProfiler . getStats ( ) ;
423- expect ( stats . enabled ) . toBe ( true ) ;
406+ expect ( stats . state ) . toBe ( 'running' ) ;
424407 expect ( stats . walOpen ) . toBe ( true ) ;
425408 expect ( stats . isSubscribed ) . toBe ( true ) ;
426409 expect ( typeof stats . queued ) . toBe ( 'number' ) ;
427410 expect ( typeof stats . dropped ) . toBe ( 'number' ) ;
428411 expect ( typeof stats . written ) . toBe ( 'number' ) ;
429412
430- statsProfiler . setEnabled ( false ) ;
413+ statsProfiler . stop ( ) ;
431414 } ) ;
432415
433416 it ( 'should provide comprehensive queue statistics via getStats' , ( ) => {
@@ -443,7 +426,7 @@ describe('NodeJS Profiler Integration', () => {
443426
444427 // Initial stats should be zero
445428 const initialStats = profiler . getStats ( ) ;
446- expect ( initialStats . enabled ) . toBe ( true ) ;
429+ expect ( initialStats . state ) . toBe ( 'running' ) ;
447430 expect ( initialStats . walOpen ) . toBe ( true ) ;
448431 expect ( initialStats . isSubscribed ) . toBe ( true ) ;
449432 expect ( initialStats . queued ) . toBe ( 0 ) ;
@@ -467,10 +450,10 @@ describe('NodeJS Profiler Integration', () => {
467450 expect ( statsAfterMeasurements . written ) . toBeGreaterThanOrEqual ( 0 ) ;
468451
469452 // Disable profiler to flush remaining items
470- profiler . setEnabled ( false ) ;
453+ profiler . stop ( ) ;
471454
472455 const finalStats = profiler . getStats ( ) ;
473- expect ( finalStats . enabled ) . toBe ( false ) ; // Should be disabled
456+ expect ( finalStats . state ) . toBe ( 'idle' ) ; // Should be idle
474457 expect ( finalStats . walOpen ) . toBe ( false ) ; // WAL should be closed when disabled
475458 expect ( finalStats . isSubscribed ) . toBe ( false ) ; // Should not be subscribed when disabled
476459 expect ( finalStats . queued ) . toBe ( 0 ) ; // Should be cleared when disabled
0 commit comments