rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.61k stars 579 forks source link

[v12] Invalid coverage report source file paths with istanbul & jest #1779

Open artus9033 opened 2 hours ago

artus9033 commented 2 hours ago

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:

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.

shellscape commented 2 hours ago

Thanks for the issue. This will likely not get resolved without community contribution.