Do you want to request a feature or report a bug?
What is the current behavior?
Test case cannot pass got following
FAIL ./test.spec.js
✕ rejects to octopus (10ms)
✕ rejects to octopus (2ms)
● rejects to octopus
expect(function).toThrow(string)
Received value must be a function, but instead "object" was found
at Object.<anonymous> (node_modules/expect/build/index.js:162:51)
at Generator.throw (<anonymous>)
at step (node_modules/expect/build/index.js:40:727)
at node_modules/expect/build/index.js:40:926
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.
Following example in https://facebook.github.io/jest/docs/en/expect.html#rejects
// test.spec.js
test('rejects to octopus', async () => {
await expect(Promise.reject(new Error('octopus'))).rejects.toThrow('octopus');
});
test('rejects to octopus', () => {
// make sure to add a return statement
return expect(Promise.reject(new Error('octopus'))).rejects.toThrow('octopus');
});
jest test.spec.js
What is the expected behavior?
expected test case should be pass.
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
{
jest: "21.2.1",
node: "v8.9.1",
yarn: "1.3.2",
os: "Ubuntu 16.04.3 LTS"
}
Do you want to request a feature or report a bug?
What is the current behavior?
Test case cannot pass got following
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can
yarn installandyarn test.Following example in https://facebook.github.io/jest/docs/en/expect.html#rejects
jest test.spec.jsWhat is the expected behavior?
expected test case should be pass.
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
{ jest: "21.2.1", node: "v8.9.1", yarn: "1.3.2", os: "Ubuntu 16.04.3 LTS" }