question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

expect.any throws a type error

See original GitHub issue

If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.

Can you reproduce the problem with latest npm?

Reproducible with 18.1.0

Description

http://stackoverflow.com/questions/41942411/typeerror-expect-any-is-not-a-function

Expected behavior

expect.any(Constructor) should work as listed in the docs for Jest

Actual behavior

Throws a TypeError

Environment

NPM v3.10.3 Node v6.6.0

  1. Operating system: OSX
  2. Browser and version: Chrome, latest(56)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Timercommented, Mar 1, 2017

@dangerismycat you probably ran something like npm upgrade react-scripts --save-exact; anyway, glad you figured it out!

1reaction
gaearoncommented, Feb 11, 2017

Should be available on 0.9.0 we just released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to test the type of a thrown exception in Jest
In Jest you have to pass a function into expect(function).toThrow(<blank or type of error>) . Example: test("Test description" ...
Read more >
How to test a function that's expected to throw error in jest…
So, I needed to write unit tests for a function that's expected to throw an error if the parameter supplied is undefined and...
Read more >
How to Correctly Expect an Error in Jest - Webtips
We have a mock function and we want to test whether it throws the error we are expecting. We can do this by...
Read more >
Expect a function to throw an exception in Jest - eloquent code
First we define the async function in a module, then in the test code we use the rejects property to test for any...
Read more >
Expect - Jest
The expect function is used every time you want to test a value. ... throw new Error('These must be of type number!');
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found