• Equivalent to calling vitest.expect(arg).toBeNull() while also asserting arg to be null.

    Parameters

    • arg: unknown

      The variable to be asserted.

    Returns asserts arg is null

    undefined.

    arg is null.

    const iAmNull: number | null = Math.random() >= 0 ? 10 : null;
    expectToBeUndefined(iAmNull);
    expect(iAmNull + 1).toBe(11);
    // ^ 'iAmNull' is possibly 'null'.