Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6288

Test render in ReactNative with Jest and reactnative-testing-library: You are trying to `import` a file after the Jest environment has been torn down

$
0
0

I have a problem when I try to test render method in my ReactNative application with EXPO, I am using JEST and reactnative-testing-library.This is my code:

import { render, fireEvent, cleanup, wait } from '@testing-library/react-native';import { LoginScreen } from '../../App/screens/LoginScreen';    import '@testing-library/jest-native/extend-expect';    import { View } from "react-native";        const fakeNavigation = {        navigation: {} as any    }        it("renders correctly", () => {      const screen =  render(<LoginScreen {...fakeNavigation}>{() => <View />}</LoginScreen>);});

Before writing this question I watched this linkReference error: `import` a file after the Jest environment has been torn downand also tried workaround

jest.useFakeTimers()

but nothing works.


Viewing all articles
Browse latest Browse all 6288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>