简体   繁体   English

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

[英]how to write unit test case for following code snippet

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

This file contains only the above lines, Should we write unit test cases for these kind of files, If yes,Please suggest how to write unit test cases for this.这个文件只包含以上几行,我们是否应该为这些文件编写单元测试用例,如果是,请建议如何为此编写单元测试用例。

Thanks in Advance提前致谢

There is no need to write tests for files that only exports something.无需为仅导出某些内容的文件编写测试。 If you have a coverageThreshold just ignore those files如果你有一个coverageThreshold就忽略这些文件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM