to be undefined

  • <any> [not] to be undefined

Asserts that the value is undefined.

expect(undefined, 'to be undefined');

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

expect('Hello world', 'to be undefined');
expected 'Hello world' to be undefined

This assertion can be negated using the not flag:

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

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

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