Equivalent to calling vitest.expect(arg).toBeUndefined() while also asserting arg to be undefined.
vitest.expect(arg).toBeUndefined()
arg
The variable to be asserted.
undefined.
undefined
arg is undefined.
const iAmUndefined: number | undefined = Math.random() >= 0 ? 10 : undefined;expectToBeUndefined(iAmUndefined);expect(iAmUndefined + 1).toBe(11); // ^ 'iAmUndefined' is possibly 'undefined'. Copy
const iAmUndefined: number | undefined = Math.random() >= 0 ? 10 : undefined;expectToBeUndefined(iAmUndefined);expect(iAmUndefined + 1).toBe(11); // ^ 'iAmUndefined' is possibly 'undefined'.
Equivalent to calling
vitest.expect(arg).toBeUndefined()
while also assertingarg
to be undefined.