Expect assertions type error -> expect(...).toExist is not a function

If you are using Jest you can also use 'toBeDefined()'


The expect assertion library has changed ownership. It was handed over to the Jest team, who in their infinite wisdom, created a new API.

You must now use toBeTruthy()instead of toExist().

You can still install expect as before, npm install expect --save-dev, which is currently at version 21.2.1. Most methods names will remain unchanged except for a few, including toExist().