PexpectFailure
Bun

property

test.default.TestOptions.expectFailure

expectFailure?: string | boolean | AssertPredicate

If truthy, the test is expected to fail. If a non-empty string is provided, that string is displayed in the test results as the reason why the test is expected to fail. If a RegExp, Function, Object, or Error is provided directly (without wrapping in { match: … }), the test passes only if the thrown error matches, following the behavior of assert.throws. To provide both a reason and validation, pass an object with label (string) and match (RegExp, Function, Object, or Error).