to be null

  • <any> [not] to be null

Asserts that the value is null.

expect(null, 'to be null');

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

expect({ foo: { bar: 'baz' } }, 'to be null');
expected { foo: { bar'baz' } } to be null

This assertion can be negated using the not flag:

expect({ foo: { bar: 'baz' } }, 'not to be null');
expect('Hello world!', 'not to be null');

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

expect(null, 'not to be null');
expected null not to be null