Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect.any throws a type error #1520

Closed
chrisjcodes opened this issue Feb 10, 2017 · 8 comments
Closed

expect.any throws a type error #1520

chrisjcodes opened this issue Feb 10, 2017 · 8 comments

Comments

@chrisjcodes
Copy link

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)
@gaearon
Copy link
Contributor

gaearon commented Feb 10, 2017

Could this be a new method in Jest 18? We are currently shipping Jest 17.
An update with Jest 18 is coming within a few days.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Seems new in Jest 18. I can confirm it works on master and will work in react-scripts@0.9.0 we're cutting very soon.

@gaearon gaearon closed this as completed Feb 11, 2017
@chrisjcodes
Copy link
Author

Awesome thanks @gaearon

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Should be available on 0.9.0 we just released.

@dangerismycat
Copy link

I'm getting this error with 0.9.3, even after nuking and reinstalling node_modules. Any ideas on what I'm missing?

@gaearon
Copy link
Contributor

gaearon commented Mar 1, 2017

I can’t reproduce this. I added console.log(typeof expect.any) into src/App.test.js of a newly generated project, and it logs a function.

So if you still have issues, you’ll need to create a project reproducing this.

@dangerismycat
Copy link

Figured it out. Somehow I ended up with react-scripts as a dependency as well as a devDependency, and when I upgraded from a previous version, only the devDependency upgraded. So I was actually using an older version of Jest, pre-expect.any. D'oh!

@Timer
Copy link
Contributor

Timer commented Mar 1, 2017

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

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants