Deprecated Storybook addon that throws migration errors directing users to the new package structure in Storybook 9.0
86
Build a lightweight call tracking system for debugging function execution flows in a UI component library. The system should track function calls, their arguments, and return values during component interactions.
You need to implement:
Call Tracker (src/tracker.ts):
Test Suite (src/tracker.test.ts):
When a method is called on a tracked object:
// Example of what the system should support
const calculator = {
add: (a: number, b: number) => a + b,
multiply: (a: number, b: number) => a * b
};
// Wrap the calculator to track calls
const tracked = wrapForTracking(calculator);
// Use normally
tracked.add(2, 3); // Returns 5
tracked.multiply(4, 5); // Returns 20
// Retrieve call history
const calls = getCallHistory();
// Should show:
// - add was called with [2, 3] and returned 5
// - multiply was called with [4, 5] and returned 20// Given: A simple object with a method
const obj = { getValue: () => 42 };
const tracked = wrapForTracking(obj);
// When: The method is called
const result = tracked.getValue();
// Then:
// - Result should be 42
// - Call history should contain one entry with method name "getValue"
// - Entry should show no arguments and return value of 42// Given: An object with a method
const counter = {
increment: (val: number) => val + 1
};
const tracked = wrapForTracking(counter);
// When: Method is called multiple times
tracked.increment(1);
tracked.increment(2);
tracked.increment(3);
// Then:
// - Call history should contain 3 entries in order
// - First entry: arguments [1], return value 2
// - Second entry: arguments [2], return value 3
// - Third entry: arguments [3], return value 4// Given: An object with a method that takes complex arguments
const processor = {
process: (config: {name: string, count: number}) => config.count * 2
};
const tracked = wrapForTracking(processor);
// When: Method is called with object argument
const result = tracked.process({name: "test", count: 5});
// Then:
// - Result should be 10
// - Call history entry should capture the full config object
// - Arguments should be [{name: "test", count: 5}]Provides debugging and call tracking functionality for interactive testing.
Install with Tessl CLI
npx tessl i tessl/npm-storybook--addon-backgroundsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10