sh33dafi / jest-sonar

A jest reporter that generates sonar reports
MIT License
49 stars 11 forks source link

Add sourcemap support #70

Open kayahr opened 1 year ago

kayahr commented 1 year ago

I'm not a friend of ts-jest so I always use a two-step process: Compile TypeScript with standard tsc from src to lib and then call Jest on the JavaScript files in lib. Jest automatically uses the sourcemaps generated by tsc to show correct TypeScript stack traces and also the Coverage report correctly shows the TypeScript sources. But jest-sonar unfortunately reports JavaScript files from the lib directory in the report and not TypeScript files from the src directory. And because of this Sonar for some reason ignores all files in the report, I guess because it expects TypeScript files, not JavaScript.

When I manually replace all paths like lib/test/Project.test.js in the report with for example src/test/Project.test.ts and let Sonar use this modified file then unit tests are correctly reported in Sonar.

So would it be possible to add sourcemap support in jest-sonar so it automatically references the TypeScript source files in the report instead of the JavaScript files? Like Jest itself is already doing it.