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

Question: Jest issue since upgrading from RN59 to RN61.rc3 #26447

Closed
jrwpatterson opened this issue Sep 15, 2019 · 2 comments
Closed

Question: Jest issue since upgrading from RN59 to RN61.rc3 #26447

jrwpatterson opened this issue Sep 15, 2019 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.

Comments

@jrwpatterson
Copy link

anybody able to help me since upgrading to RN61 when I try to mock native modules in this way...

jest.mock('Alert', () => ({
alert: jest.fn()
}))

it just tells me

Cannot find module 'Alert' from '.tsx'

I haven't changed the code...

@jrwpatterson jrwpatterson added the Type: Question Issues that are actually questions and not bug reports. label Sep 15, 2019
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

👉 Click here if you want to report a reproducible bug or regression in React Native.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: No Template labels Sep 15, 2019
@ide
Copy link
Contributor

ide commented Sep 15, 2019

You need to mock the JS module -- either a file or a package, but not a native module. Ex: you could mock the package: jest.mock('react-native', ...).

@facebook facebook locked as resolved and limited conversation to collaborators Oct 3, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.
Projects
None yet
Development

No branches or pull requests

3 participants