expect.any throws a type error
See original GitHub issueIf 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
- Operating system: OSX
- Browser and version: Chrome, latest(56)
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dangerismycat you probably ran something like
npm upgrade react-scripts --save-exact
; anyway, glad you figured it out!Should be available on 0.9.0 we just released.