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

Does not mock module that require object-assign. #201

Closed
dmwyatt opened this issue Dec 16, 2014 · 4 comments
Closed

Does not mock module that require object-assign. #201

dmwyatt opened this issue Dec 16, 2014 · 4 comments

Comments

@dmwyatt
Copy link

dmwyatt commented Dec 16, 2014

Take the flux ChatAppDispatcher from the flux chat example app that uses the object-assign ponyfill.

When you are testing module X that requires ChatAppDispatcher, jest returns undefined instead of a mocked object for module X.

If you copy the relevant code out of the object-assign module and just use it right in ChatAppDispatcher.js jest then mocks appropriately.

@dangerbell
Copy link

Jest is mocking the module object-assign. So when you do assign({}, Base, Other) the assign function is just a mock and it doesn't do anything.

So you'll want to use jest.dontMock('object-assign') at the top of your test.

@orlando
Copy link

orlando commented Jun 3, 2015

Thanks!. I just had this issue and found that object-assign was mocked, but didn't know how to not mock it.

@ghost
Copy link

ghost commented Aug 5, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
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