我是原生反应新手,遇到了测试问题。\n首先,我的应用程序运行正常。\n只有当我想用玩笑测试我的应用程序并且我的应用程序中有图标时,才会出现该问题。
\n以下消息告诉我,可能存在延迟导入加载,在某些方面与笑话冲突,但我不知道如何解决或修复此问题:\nReferenceError: You are trying to 'import' a file after the Jest environment has been torn down.
我已经测试了我的应用程序,icon="camera"并且测试运行良好,因此它与图标非常相关。
该应用程序还使用react-native-paper。
\n即使应用程序中有图标,我如何测试它?
\n这是重现该错误的最小 App.js:
\nimport { StatusBar } from 'expo-status-bar';\nimport React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\nimport { Provider as PaperProvider } from 'react-native-paper';\nimport { Button } from 'react-native-paper';\n\nexport default function App() {\n return (\n <PaperProvider>\n <View style={styles.container}>\n <Text>Thi is a test</Text>\n <Button icon="camera" mode="contained" onPress={() => console.log('Pressed')}>\n Press me\n …Run Code Online (Sandbox Code Playgroud)