我使用创建-反应-应用程序,它使用Jest进行测试。我有包含导出行的index.js文件,如
export { default } from './App.component';这减少了我的应用程序的测试覆盖率。
Q:如何测试这些文件,或者至少忽略它们?
发布于 2018-10-10 18:49:07
您可以在jest配置中使用collectCoverageFrom配置忽略这些文件。
{
"jest": {
collectCoverageFrom: [
'<yourDirectoryStructure>/**/*.{js,jsx}',
'!<yourDirectoryStructure>/**/index.{js,jsx}',
]
}
}https://stackoverflow.com/questions/52742997
复制相似问题