to be empty

  • <array-like> [not] to be empty

Asserts that an array (or array-like object) is empty.

Aliases: to be the empty array, to be an empty array

expect([], 'to be empty');

In case of a failing expectation you get the following output:

expect([1,2,3], 'to be empty');
expected [ 123 ] to be empty

This assertion can be negated using the not flag:

expect([1,2,3], 'not to be empty');

In case of a failing expectation you get the following output:

expect([], 'not to be empty');
expected [] not to be empty