Skip to content

DescribeStack

Defined in: packages/core/src/observe/describe-stack.ts:11

new DescribeStack(): DescribeStack

DescribeStack

get depth(): number

Defined in: packages/core/src/observe/describe-stack.ts:71

Current nesting depth, used by preloads to decide whether a test is top-level.

number


get snapshot(): readonly string[]

Defined in: packages/core/src/observe/describe-stack.ts:20

Frozen snapshot of the current frames. Used by the describe wrapper to capture the path at describe-call time (synchronous w.r.t. the outer body), then replay it via runWithFrames whenever the runtime executes the nested body. Returning a frozen copy prevents callers from mutating internal state.

readonly string[]

path(testName): string

Defined in: packages/core/src/observe/describe-stack.ts:63

Returns the full path for a test, joined by >.

string

string


run<T>(name, body): T

Defined in: packages/core/src/observe/describe-stack.ts:28

Runs body with name pushed onto the stack. Pop is guaranteed by try/finally so a thrown describe body does not leave a dangling frame.

T

string

() => T

T


runWithFrames<T>(frames, body): T

Defined in: packages/core/src/observe/describe-stack.ts:47

Runs body with the stack temporarily replaced by frames (absolute, not appended). Used to restore a describe-path captured at registration time, since Bun defers nested describe body execution.

T

readonly string[]

() => T

T