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
The coverage location is not the original source location when the previous plugins transformed #24
Comments
Hi @billowz First of all, thank you for taking the time to review the new version and open the issue. I've double checked the issue and your proposed solution in #22. I think that you are asking for a fix that I've implemented in #25. Could you review it? Anyway, before merging it, I want to understand why it is needed and why are you instrumenting the code after transforming it with babel. I mean, I think that a solution to your problem could be to instrument the code before transforming it: /* ... */
plugins: [
istanbul({ /* ... */ }),
babel({ /* ... */ })
]
/* ... */ If you do so, I think that you will have the coverage pointing to the proper lines. Why are you instrumenting at the end? In addition, I've been doing some tests with the sample project in examples/karma. If I apply the fix (using the code in
Which is wrong because, as you can see the example, it is not covering the 100% of the functions. But if I use the current
Which is more accurate and it points to the proper uncovered lines also. Could you help me understanding why I should make the change? |
@artberri svelte code must be preprocessed with rollup-plugin-svelte before being instrumented, hence the need for this. |
I have a similar issue when compiling TypeScript. I feel the source maps always correspond to the compiled JS, not the TS source. I also tried multiple config options (including instrumenting first, then compiling), but nothing seems to help. |
I have the same problem with a react/typescript/vite project, and wrote my own plugin based on |
@tifrel I also have this problem, have you solved it? |
@powerdong Yes and no. The code is on my old machine, so I cannot check it right now. I played around with istanbul + TS + gulp. It turned out that there was one specific combination of options which would do, IIRC instrumenting the TS and then compiling without TS source maps. Didn't get it to work with rollup though, but you might find a way (let me know, still interested) |
I'll add the fix in the next version that will be published during this week. |
Issue tracker is ONLY used for reporting bugs. Use stackoverflow for supporting issues and questions.
Expected Behavior
Coverage requires the sourcemap of the previous plugins to return to its original form
Current Behavior
The coverage points to code transformed by the previous plugins
Possible Solution
see #22, rollup/rollup#2983, the istanbul-lib-instrument require the inputSourceMap to maps the not instrumented code back to it's original form
Steps to Reproduce
fixtures/main.js:
rollup:
fixtures/main.js transformed by babel:
The instrument uses transformed code from babel
The text was updated successfully, but these errors were encountered: