LCOV - code coverage report
Current view: top level - src/platform/telemetry/nodeAdded - nodeAddSource.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 77.8 % 9 7
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { NodeAddSource } from '@comfyorg/telemetry/types'
       2              : 
       3         2356 : let currentSource: NodeAddSource = 'unknown'
       4              : 
       5            0 : export function getCurrentNodeAddSource(): NodeAddSource {
       6            0 :   return currentSource
       7              : }
       8              : 
       9              : /**
      10              :  * Set the node-add source for the duration of `fn`. Synchronous only —
      11              :  * the source is read by the synchronous LGraph.onNodeAdded callback that
      12              :  * fires inside `graph.add()`. Nesting restores the previous value on exit.
      13              :  */
      14          117 : export function withNodeAddSource<T>(source: NodeAddSource, fn: () => T): T {
      15          117 :   const previous = currentSource
      16          117 :   currentSource = source
      17          117 :   try {
      18          117 :     return fn()
      19              :   } finally {
      20          117 :     currentSource = previous
      21              :   }
      22              : }
        

Generated by: LCOV version 2.0-1