@sv443-network/coreutils
Version:
Cross-platform, general-purpose, JavaScript core library for Node, Deno and the browser. Intended to be used in conjunction with `@sv443-network/userutils` and `@sv443-network/djsutils`, but can be used independently as well.
12 lines (11 loc) • 495 B
TypeScript
import { type Assertion } from "vitest";
/**
* Run an assertion in "soft" mode: catch assertion errors and log them instead of throwing.
*
* @example ```ts
* softExpect(() => expect(actual).toBe(42));
* softExpect(actual, e => e.toBe(42), "optional message");
* ```
*/
export declare function softExpect(assertion: () => void | unknown): void;
export declare function softExpect<T>(actual: T, assertion: (expectation: Assertion<T>) => void | unknown, message?: string): void;