MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / measuredStep

Function measuredStep

scripts/integration/js-api.mjs:653–673  ·  view source on GitHub ↗
(label, fn, options = {})

Source from the content-addressed store, hash-verified

651}
652
653async function measuredStep(label, fn, options = {}) {
654 const parentTiming = activeTiming;
655 const timing = {
656 label,
657 phase: options.phase ?? phaseTest,
658 startedAt: Date.now(),
659 elapsedMs: 0,
660 sleepMs: 0,
661 ok: false,
662 };
663 activeTiming = timing;
664 try {
665 const result = await fn();
666 timing.ok = true;
667 return result;
668 } finally {
669 timing.elapsedMs = Date.now() - timing.startedAt;
670 stepTimings.push(timing);
671 activeTiming = parentTiming;
672 }
673}
674
675function sleep(ms) {
676 if (activeTiming) activeTiming.sleepMs += ms;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected