问题描述
我在项目中使用了笑话单元测试。一段时间以来一切正常。我最近将dotenv与我的项目集成在一起。现在,所有文件的测试均失败。我进行运行测试时收到以下错误。
dotenv项目结构
我的实际代码
import { Linking,AsyncStorage,Platform,Alert } from "react-native";
import { Toast } from "native-base";
import { ZOOM_APP_PLAYSTORE,ZOOM_APP_APPSTORE,ZOOM_URL } from "@env";
import { General } from "../Constants";
当我运行该应用程序时,它运行正常,并且仅运行测试时出现问题。
单元测试-开玩笑
测试代码
describe("Testpage Component",() => {
it('renders without crashing',() => {
const rendered = renderer.create(<Provider store={store}>
<DrawerComponent />
</Provider>).toJSON();
expect(rendered).toBeTruthy();
});
});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)