MCPcopy
hub / github.com/vercel/next.js / withCurrent

Function withCurrent

turbopack/packages/devlow-bench/src/describe.ts:76–85  ·  view source on GitHub ↗
(
  current: CurrentScenario,
  fn: () => Promise<void>
)

Source from the content-addressed store, hash-verified

74let currentScenario: CurrentScenario | null = null
75
76export function withCurrent(
77 current: CurrentScenario,
78 fn: () => Promise<void>
79): Promise<void> {
80 const prev = currentScenario
81 currentScenario = current
82 return fn().finally(() => {
83 currentScenario = prev
84 })
85}
86
87export const PREVIOUS = Symbol('previous measurement with that unit')
88

Callers 1

runScenariosFunction · 0.85

Calls 2

finallyMethod · 0.80
fnFunction · 0.50

Tested by

no test coverage detected