Attempting to follow this documentation:
Alternatively, you can use async/await in combination with .rejects.
test('rejects to octopus', async () => {
await expect(Promise.reject(new Error('octopus'))).rejects.toThrow('octopus');
});
I get the error:
$ jest
FAIL .\index.test.js
× async error handling from docs (5ms)
● async error handling from docs
expect(function).toThrow(string)
Received value must be a function, but instead "object" was found
Steps to reproduce:
- mkdir test
- yarn add jest
- touch index.test.js
- paste above example from documentation
- run
jest
Environment (most likely of little relevance here):
yarn 1.3.2
node v8.5.0
windows 7
Attempting to follow this documentation:
I get the error:
Steps to reproduce:
jestEnvironment (most likely of little relevance here):
yarn 1.3.2
node v8.5.0
windows 7