* Asserts that decoding `input` fails and the stringified issue equals * `message`. * * **When to use** * * Use to verify that invalid decoding input produces the expected issue text. * * **Example** (Asserting a decoding failure) * * ```ts import.meta.vitest * import {
(
this: Decoding<S>,
input: unknown,
message: string
)
| 395 | * @see {@link succeed} for asserting successful decoding |
| 396 | */ |
| 397 | async fail<S extends Schema.ConstraintDecoder<unknown, never>>( |
| 398 | this: Decoding<S>, |
| 399 | input: unknown, |
| 400 | message: string |
| 401 | ) { |
| 402 | const r = await Effect.runPromise( |
| 403 | this.decodeUnknownEffect(input, this.options?.parseOptions).pipe( |
| 404 | Effect.mapErrorEager(SchemaIssue.defaultFormatter), |
| 405 | Effect.result |
| 406 | ) |
| 407 | ) |
| 408 | assert.deepStrictEqual(r, Result.fail(message)) |
| 409 | } |
| 410 | /** |
| 411 | * Returns a new {@link Decoding} instance with the given service injected into the decoding effect context. |
| 412 | * |