import { type ITrace, type ITraceWith, TraceableImpl } from '../lib/index'; export class CollectingTrace implements ITrace { constructor( private readonly collector: Array>> = [], private readonly scopes: Array> = [], ) {} public get events() { return this.collector; } public traceScope(trace: ITraceWith): ITrace { return new CollectingTrace(this.collector, this.scopes.concat([trace])); } public trace(trace: ITraceWith) { this.collector.push(this.scopes.concat([trace])); } } export class TestTraceable extends TraceableImpl { constructor(item: T, trace: ITrace) { super(item, trace); } static of(item: T, trace: ITrace) { return new TestTraceable(item, trace); } }