gpt4 book ai didi

javascript - 如何为以下代码片段编写单元测试用例

转载 作者:行者123 更新时间:2023-12-02 21:32:07 25 4
gpt4 key购买 nike

export { className } from "path";  
export { className1} from "path";
export { className2 } from "path";
export { className3 } from "path";

该文件仅包含上述几行,我们是否应该为此类文件编写单元测试用例,如果是,请建议如何为此编写单元测试用例。

提前致谢

最佳答案

无需为仅导出某些内容的文件编写测试。如果您有 coverageThreshold,只需忽略这些文件

// jest.config.js
module.exports = {
...
collectCoverage: true,
collectCoverageFrom: [
'path/to/collect/**',
'!path/to/ignore/**',
],
coverageThreshold: {
global: {
...
},
},
};

关于javascript - 如何为以下代码片段编写单元测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60595860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com