Skip to main content

Variable: toBeErr

const toBeErr: MatcherFunction

Defined in: testing/matchers/result.ts:111

Assert that a Result is Err, optionally checking the error.

Example

import { expect } from 'vitest'
import { ok, err } from 'receta/result'

expect(err('fail')).toBeErr() // Pass
expect(err('fail')).toBeErr('fail') // Pass
expect(err('fail')).toBeErr('other') // Fail
expect(ok(5)).not.toBeErr() // Pass