1.0.0
Type-checking utilities
Checks if the value is true and throws an error if not.
(any)
The value to check.
(string?)
The name of the value
(string?)
A custom message to describe the error.
any
:
the value passed.
Valid inputs
expect.true(true);
Invalid inputs
expect.true(false);
// => TypeError: Expected the value to be true, but found: false
expect.true(false, "canFly");
// => TypeError: Expected canFly to be true, but found: false
expect.true(false, "canFly", "${name} should be true, but found: ${actual}");
// => TypeError: canFly should be true, but found: false
Checks the value is false.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a boolean.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a number.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a string.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Ensues the value is an object.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a function.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an array.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an array.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an array-like object.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a Symbol.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a BigInt.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an iterable.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an iterable.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a primitive type.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a plain object.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a truthy value. All values are truthy unless they are defined as falsy (i.e., except for false, 0, 0n, "", null, undefined, and NaN).
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a falsy value. There are 7 falsy values in JavaScript: false, 0, 0n, "", null, undefined, and NaN.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not null or undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not null or undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not null or undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a numeric value.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a numeric value.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a numeric value.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a numeric value.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is an infinite value.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is NaN.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a native function.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value has the specified type.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value has the specified type.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value has the specified type.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not undefined.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is not null.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is NaN.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);
Checks the value is a non-native function.
any
:
the value passed.
Valid inputs
// no error
expect.boolean(true);
Invalid inputs
// throws an error
expect.boolean(1);