-
Notifications
You must be signed in to change notification settings - Fork 107
Incorrect Coverage #5
Comments
I created a fork with a Clone,
Since the line numbers are off, this causes an error in the HTML reporter when it tries to annotate lines from the original source file that are not present. Note that this is only affecting code coverage. The actual test process itself is working fine, so you can disable code coverage and be able to continue working. |
@hotforfeature thank you vary much for your report. It looks related by the order of the plugin (see artberri/rollup-plugin-istanbul#6), but unfortunately typescript complicate things. I have open an issue on rollup-plugin-istanbul, but i will keep trying to resolve it. Maybe same tweak on ts + istanbul plugins can make the magic. |
+1 I got the same problem. I tring find the solution by now...I've did a test with a new project using |
I think that missing point is a rollup-remap-istanbul-plugin that wrap https://github.com/SitePen/remap-istanbul. About webpack, have you noticed this PR :) -> ionic-team/ionic-app-scripts#158 |
@hotforfeature I had the same error with karma-remap-istanbul, switched to karma-remap-coverage as workaround without problems. Did you inline the source maps as suggested? |
@duydao tried source inline but not karma-remap-coverege yet. Thank you, will try soon. Do you mind pasting same of your code from karma.config to speed up things? Anyway thank you! |
Sure, this is the relevant configuration in karma.conf.js: reporters: ['mocha', 'coverage', 'remap-coverage'],
coverageReporter: {
type: 'in-memory'
},
remapCoverageReporter: {
'text-summary': null, // to show summary in console
html: './coverage/html'
}, |
@duydao mmm there is something I'm missing in rollupPreprocessor i think. I tried
But it's throwing:
|
There seems to be a JS error in the karma.conf.js or in the shim. Sorry, I don't have the excact config file anymore, we moved to system.js since rollup was terribly slow due to redux (or having lots of module dependencies like rxjs). We are using a modified karma config of https://github.com/angular/quickstart |
Using the above configuration for me does not generate any errors, but it presents 0/0 code code coverage for statements, branches, functions, and lines. I think I got that error once because |
Last release 0.10.* fixed Istanbul. Also as the ionic team as moved to Webpack i changed the bundling system for unit tests from Rollup to Webpack. This release has finally Typedoc working for documentation. Thank you all, and let me know if you have any issue with the new release. |
Thanks @marcoturi, it's working now after I updated my repository to match. Quick note if anybody finds this issue and is still having problems: it is critical that |
@hotforfeature Thanks for the info, i would add another issue i met during the upgrade. If you ancounter any issue about karma not reloading correctly in watch mode, look here. Finally for tracking purpose, the issue about istanbul-instrumenter-loader is tracked here |
The current coverage being generated does not reflect the source. At the moment, since the test files are so simple, it's hard to notice. However, when a more complex class and test spec is introduced, we get errors when the coverage points to lines that don't match up to the source file.
I believe the problem is that
rollup-plugin-stanbul
is instrumenting the wrong file. I've tried with no luck to try and get either thekarma-remap-istanbul
or thekarma-remap-coverage
working to compensate.The text was updated successfully, but these errors were encountered: