Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
artus9033 opened this issue Sep 29, 2024 · 1 comment
Open

Comments

@artus9033
Copy link

artus9033 commented Sep 29, 2024

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 build to run rollup
  • npm run test:unit to run jest with --coverage on 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 artus9033/chartjs-plugin-dragdata@d43a3cf) fixes the problem.

@shellscape
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants