nx-sonarqube icon indicating copy to clipboard operation
nx-sonarqube copied to clipboard

Fail to find coverage paths in vite configuration with vite 5 if CJS node API is not used anymore

Open ltparis2018 opened this issue 6 months ago • 0 comments

If possible, please provide a reproduction repository you discovered this bug in.

No response

Which area/package is the issue in?

@koliveira15/nx-sonarqube

Description

Since vite 5 the CJS node API has deprecated (see vite.js site for details). Therefore the vite configuration file has now to use the ESM syntax. You can still use vite.config.js file name but then you have to configure the type field of your package.json to module. The other approach is to rename the vite configuration file using the .mjs/.mts extension, e.g. vite.config.mjs or vite.config.mts. Unfortunately, the second case is not supported by nx-sonarqube yet. It only searches for a vite.config.js file (see src/executors/scan/utils/utils.ts, line L171). Consequence is that the coverage paths cannot be found.

If applicable, please provide the Nx report

No response

Please provide the exception or error you saw

There was no explicit error message. The effect of this problem is that the sonar scanner has no valid path to the lcov report. Code coverage analysis is always skipped then. This leads to a failed sonar analysis if code coverage is a quality gate.

Other information

No response

I would be willing to submit a PR to fix this issue

  • [ ] Yes
  • [X] No

ltparis2018 avatar Aug 09 '24 11:08 ltparis2018