reactjs - 弹出创建反应应用程序笑话覆盖率报告不准确
问题描述
我使用 create-react-app 创建了一个应用程序,然后我将其弹出。目前正在做我的测试套件,我想展示我的测试覆盖率,所以我在我的 package.json 下添加了“collectCoverage”:true。运行测试后,它没有显示我的测试覆盖率
有什么我需要做的吗?
这是 Links.test.jsx
import React from "react";
import { shallow, mount } from "enzyme";
import Links from "./Links";
it("should show correct links", () => {
const wrapper = mount(<Links />);
expect(wrapper).toMatchSnapshot();
});
下面是正在测试的 Links 组件
import React from "react";
const Links = () => {
return (
<div className="container mb-4 mt-4" id="Links">
<div className="h4 mb-3">OUR LINKS</div>
<div className="d-flex justify-content-between flex-wrap mw-90">
<a
href="https://site.ca/sites.aspx"
target="_blank"
className="buttonImage siteImage"
>
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">My Site</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage mapsImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">Maps</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage loopImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">Social</div>
</div>
</a>
<a href="#" target="_blank" className="buttonImage polcyImage">
<div className="darkenBackground d-flex flex-column justify-content-center">
<div className="text-center h4">
Acceptable Use <br /> and Security Policies
</div>
</div>
</a>
</div>
</div>
);
};
export default Links;
解决方案
推荐阅读
- java - 休眠方法名称到 SQL 查询 - OR 语句
- ios - 仅在用户尚未订阅时显示按钮标题
- 3d - Slic3r-console --cut-x 和 --cut-y 不工作
- javascript - 赛普拉斯中的异步性和变量覆盖
- r - 使用“table”函数在 R 中创建转换矩阵
- kubernetes - tcp 连接如何在 kubernetes 负载均衡器中工作
- django - 如何在 django 中正确编写 form_valid 方法
- r - 在 data.table 中删除 R 中的特定组
- javascript - 这些值不会被新值替换
- javascript - 如何将此嵌套数据的返回值打印为数组