英文:
Exclude the test files for React components in sonarcloud
问题
我有一个React应用程序,具有以下文件夹结构
src
components
Component1
Component1.tsx
Component2.test.tsx
Component2
Component2.tsx
Component2.test.tsx
utils
reducers
pages
我想从sonar云覆盖中排除src文件夹中的*.test.tsx文件。我可以将其移动到一个测试文件夹,然后从覆盖中排除测试文件夹,但这将对整个代码库进行非常大的更改。
我有一个sonar-project.properties文件,其中有一个sonar.coverage.exclusions
,但我不确定如何将其添加到这个特定的用例中。
英文:
I have a React application with the following folder structure
src
components
Component1
Component1.tsx
Component2.test.tsx
Component2
Component2.tsx
Component2.test.tsx
utils
reducers
pages
I would like to exclude the *.test.tsx files in the src folder from the sonar cloud coverage. I could move it to a test folder and then exclude the test folder from the coverage but that would be a very big change for the entire codebase.
I have a sonar-project.properties file that has a sonar.coverage.exclusions
but I am not sure how to add it for this particular use-case.
答案1
得分: 1
sonar.coverage.exclusions = src/**/*.test.tsx
英文:
I think, to exclude the *.test.tsx
files in the src folder from the SonarCloud coverage, you can add the following line to your sonar-project.properties file:
sonar.coverage.exclusions = src/**/*.test.tsx
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论