Jest · Matcher
toBeDefined
Jest's toBeDefined matcher checks that a value is not undefined. Use it when a function or expression should produce a defined result.
Last updated
Syntax
expect(value).toBeDefined()In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expect(value)toBeUndefinedtoBeNulltoBeTruthytoBeFalsy