Using Sonarcloud with our Bitbucket repo and a Jenkins build pipeline
Some background:
We’ve recently switched from Jest to Vitest for testing in our React app, and we’ve been running into issues with snapshot tests failing during our Jenkins builds. Even though we’ve manually updated the snapshots locally, SonarCloud is still flagging them as failed in the pipeline. What’s odd is that despite the snapshots being regenerated, Jenkins seems to find discrepancies between the old and new ones.
Additionally, even though Vitest is generating the coverage report, SonarCloud isn’t receiving it when the tests fail. My understanding is that SonarCloud should still be able to process coverage data regardless of some test failures. We’ve excluded the snapshot files from coverage and duplication checks in SonarCloud, but that alone doesn’t seem to resolve the issue since the tests are still failing outright.
Any thoughts on why this might be happening or what we can do to ensure both the tests and coverage reporting work smoothly?