istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.59k stars 359 forks source link

How to make the report always uses specify path? #1583

Open MelonHjy opened 3 weeks ago

MelonHjy commented 3 weeks ago

When generating HTML reports with nyc, the directory paths for coverage reports are inconsistent. For example, when the coverage information includes directories /User/test/pc/common, /User/test/pc/public/src/services, and /User/test/pc/public/src/pages, the resulting report's coverage directory paths appear as common, public/src/services, and public/src/pages. However, when the coverage information includes only the /User/test/pc/public/src/services and /User/test/pc/public/src/pages directories, the resulting report's coverage directory paths are services and pages. How can I fix the paths so that the report always uses the part of the path after /User/test/pc? In other words, regardless of whether /User/test/pc/common is included, the coverage directory paths in the report should always be public/src/services and public/src/pages.

MelonHjy commented 3 weeks ago
image