DescribeStack
Defined in: packages/core/src/observe/describe-stack.ts:11
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DescribeStack():
DescribeStack
Returns
Section titled “Returns”DescribeStack
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
snapshot
Section titled “snapshot”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”readonly string[]
Methods
Section titled “Methods”path()
Section titled “path()”path(
testName):string
Defined in: packages/core/src/observe/describe-stack.ts:63
Returns the full path for a test, joined by >.
Parameters
Section titled “Parameters”testName
Section titled “testName”string
Returns
Section titled “Returns”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”string
() => T
Returns
Section titled “Returns”T
runWithFrames()
Section titled “runWithFrames()”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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”frames
Section titled “frames”readonly string[]
() => T
Returns
Section titled “Returns”T