Error on latest version on Jest (23.5.0)
See original GitHub issueHere’s a checklist you can use to make sure your issue can be more easily resolved:
- Check against the latest
- Include a link to the example application source code
- Paste into this issue the exact error messages messages you’re seeing
Whenever I run my tests with Jest version 21.2.1 everything works fine, but when I install Jest version 23.5.0 I receive the following error:
Error: expect(jest.fn())[.not].toHaveBeenCalledWith()
jest.fn() value must be a mock function or spy.
Received: function: [Function getItem]
i.e. localStorage.getItem
is not being mocked out
I’m on the latest version of jest-localstorage-mock (2.2.0) and my test setup file looks as follows:
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'jest-localstorage-mock';
configure({ adapter: new Adapter() });
beforeEach(() => {
localStorage.clear();
});
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
jest 23.5.0 vulnerabilities - Snyk
Report a new vulnerability Found a mistake? Direct Vulnerabilities. No direct vulnerabilities have been found for this package in Snyk's vulnerability database.
Read more >Unresolved function or method "xxx" from Jest (23.5.0) in ...
For all the Jest methods (e.g. toHaveBeenCalledWith , toHaveLength ), I receive a Unresolved function or method "xxx" error. I have @types/jest ...
Read more >jest - npm
Latest version : 29.3.1, last published: 2 months ago. Start using jest in your project by running `npm i jest`.
Read more >jest | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >Unit Testing - Gatsby
Unit testing is a great way to protect against errors in your code before you deploy ... Note: if you're using Jest 23.5.0...
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
It seems that upgrading to Jest 22.0.0 or beyond causes the issue
Hey, guys, I guess this issue could be closed due merge of #80. Btw, I don’t see any release with this changes. Any comments on this?