[v12] Invalid coverage report source file paths with istanbul & jest
- Rollup Plugin Name:
@rollup/plugin-typescript - Rollup Plugin Version: 12.1.0
- Rollup Version: 4.22.5
- Operating System (or Browser): MacOS 14
- Node Version: 20.17.0
- Link to reproduction: https://github.com/artus9033/chartjs-plugin-dragdata/tree/fe73c02c25b31f784b654f80a1272d0f9bdb5582
Expected Behavior
Running rollup to generate bundles & running jest --coverage-based unit tests on these bundles should output proper reports that carry valid paths to source files.
Actual Behavior
Running rollup & running tests with coverage generates coverage reports, however, file paths in the JSON reports contain paths that are one level above the root directory of the project. For instance, if the repo had been cloned to /home/user/Desktop/repo/, the paths to sources inside coverage-final.json files would have been /home/user/repo/ (Desktop omitted).
Additional Information
To reproduce, npm test could be run, however, since this is a complex pipeline, the following procedure will be easier to pinpoint the problems:
-
npm i -
npm run buildto run rollup -
npm run test:unitto run jest with--coverageon test bundle produced by rollup in the previous step, with istanbul's instrumentation already present - check
coverage/unit/coverage-final.json: it will contain the paths to sources being "one level too high" relative to the repo's root
The changes since previous commit, where everything has been working, include upgrading multiple packages and @rollup/plugin-typescript from ^11.1.6. However, even with all the changes present, when downgrading @rollup/plugin-typescript back to ^11.1.6, everything will work properly, effectively meaning that the issue most likely resides in the plugin.
The only logic that changes after upgrading to v12 is adding compilerOptions: { outDir: outDirOverride, }, to the plugin's options in rollup.config.js due to the new requirements (rollup plugin ts complaining about outDir not residing in the rollup file option location). Reverting the upgrade (see https://github.com/artus9033/chartjs-plugin-dragdata/pull/153/commits/d43a3cfe219d0e5eef4d18498b51dd140d754863) fixes the problem.
Thanks for the issue. This will likely not get resolved without community contribution.
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ