Hi everyone,
I’m working on a Next.js application and I’ve successfully set up unit testing using Jest, with coverage being reported to SonarCloud.
However, I’m running into an issue:
Test files themselves are being included in the coverage report, as if they were files that need to be tested. This is impacting the coverage percentage and the way the results are displayed in SonarCloud.
I’ve already configured collectCoverageFrom
in my jest.config.js
to include only relevant application files like app/**
and components/**
, and my test files follow the .test.tsx
naming convention.
Is there a way to exclude test files from the coverage metrics or instruct SonarCloud to treat them correctly?
Any guidance would be appreciated!
Thanks in advance.