cli icon indicating copy to clipboard operation
cli copied to clipboard

Make getNxCoveragePaths more robust

Open matejchalk opened this issue 1 year ago • 1 comments

User story

As an Nx user, I want to use the getNxCoveragePaths function to more easily configure @code-pushup/coverage-plugin. However, this function has too many assumptions built-in for it to be useful for a simple Nx + Jest setup.

Acceptance criteria

  • [x] do not require coverageDirectory (Jest) or reportsDirectory (Vitest) option to be set in project.json, also look for these properties in jest.config.ts and vitest.config.ts files (customizable via config option in project.json)
  • [ ] Vitest's paths are relative to project root, but Jest's paths are relative to workspace root - the projectPath property should only be set for Vitest, not Jest

Implementation details

No response

matejchalk avatar Mar 05 '24 10:03 matejchalk

Related comment: https://github.com/code-pushup/cli/pull/604#discussion_r1555497103

Tlacenka avatar Apr 08 '24 09:04 Tlacenka

Vitest's paths are relative to project root, but Jest's paths are relative to workspace root - the projectPath property should only be set for Vitest, not Jest

Additional information: For Cypress + nyc it is also relative to project root, not workspace root. However, Cypress can configure coverage from different sources so relying on report-dir inside .nycrc.json would not be wise.

Tlacenka avatar Jun 05 '24 11:06 Tlacenka