import type { AssertionError } from 'node:assert'; interface SoftFailure { error: AssertionError | Error; matcherName: string; location?: string; frames: string[]; } /** * Captures the stack at the call of `fn`. V8 formats a stack when it is read, so a passing assertion does not format it. */ export declare const captureCaller: (fn: (...args: never[]) => unknown) => { stack?: unknown; }; /** * The frames that lead to the captured call, starting at its direct caller */ export declare const callerFrames: (capturedCaller: { stack?: unknown; }) => string[] | undefined; /** * Soft assertion service to collect failures without stopping test execution */ export declare class SoftAssertService { /** * Fallback test ID used when no test context is set (e.g., in Cucumber steps). * * NOTE: usage of this fallback ID in parallel execution environments may result * in soft assertion failures from different tests being aggregated together. * Ensure proper test context is set in hooks whenever possible. */ static readonly GLOBAL_TEST_ID = "__global_soft_assert_context__"; private cleanStack; private failureMap; private currentTest; private constructor(); /** * Get singleton instance, shared across every module instance of this package * loaded in the same process (see util/globalSingleton.ts). */ static getInstance(): SoftAssertService; /** * Set the current test context */ setCurrentTest(testId: string, testName?: string, testFile?: string): void; /** * Clear the current test context */ clearCurrentTest(): void; /** * Get current test ID */ getCurrentTestId(): string | null; /** * Add a soft failure for the current test * If no test context is set, failures are stored under a global fallback ID * to ensure soft assertions work even when hooks haven't set the context */ addFailure(error: Error, matcherName: string, frames?: string[]): void; setCleanStack(cleanStack: boolean): void; private framesToReport; /** * Get all failures for a specific test * Falls back to global test ID if no context is set */ getFailures(testId?: string): SoftFailure[]; /** * Clear failures for a specific test * Falls back to global test ID if no context is set */ clearFailures(testId?: string): void; /** * Throw an aggregated error if there are failures for the current test * Falls back to global test ID if no context is set */ assertNoFailures(testId?: string): void; } export {};