to be negative

  • <number> [not] to be negative

Asserts that the number is negative.

expect(-42, 'to be negative');

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

expect(0, 'to be negative');
expected 0 to be negative

This assertion can be negated using the not flag:

expect(0, 'not to be negative');
expect(42, 'not to be negative');

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

expect(-1, 'not to be negative');
expected -1 not to be negative