-
Notifications
You must be signed in to change notification settings - Fork 915
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
Code coverage for vue components with isparta #195
Comments
You need to apply isparta only to the js part of vue files, so you need to use the |
This very same happens to me but with Browserify. I get correct mapping from the rest of the javascript files, except the *.vue, it shows the transpiled code. Any thoughts? browserify: {
debug: true,
plugin: [require('proxyquireify').plugin],
extensions: ['.vue', '.js'],
transform: [
['vueify'],
istanbul({
instrumenterConfig: { embedSource: true },
instrumenter: isparta,
ignore: [
'**/node_modules/**',
'**/test/**'
]
}),
['babelify']
]
} |
@sorioinc Did you solve this? |
@mediafreakch I started looking into this last week. I tried many things and surprisingly I didn't use istanbul or browserify directly; finally got it working by using karma karma-coverage babel-plugin-istanbul, nothing else. This repo set me on the right track: https://github.com/kt3k/example-karma-browserify-babel-istanbul hope it helps. |
@sorioinc Are you using this now to assess the coverage of |
I was singing victory too fast... however, the last 16 hours, after going through the guts of vueify, babelify, istanbul-lib-instrument and babel-core... Found that adding babelify (with the
|
Are the Also, does the report look correct if you look at a |
I found a
Make sure you have The thing I cannot wrap my head around is that the coverage is not influenced by my unit tests that check whether a component property behaves correctly.
The coverage report shows that |
What version of Vueify are you using 9.x? I'm still using the previous version, my project is Vue 1.x. Being said that, versión 8.x doesn't send the filename to And yes, the generated report seems kind of off, however the percentages seem fine. Btw, you can have the babel options in the root directory of you project on a file called Please don't mind the rewireify transforms, I did not intend to send them in the snippet. In Vue 1.x I mount the vm and extract the component, then get to call the component's method explicitly like:
I don't see where you call it explicitly or make that piece of code run and assert on it. |
Oh ok I'm using Vue 2 with vueify 9.x. I updated my previous comment to give clarity about the helpers. I'm using a helper function that mounts my component and renders it with the props data I pass to it. In my example I intentionally don't assert the |
If it's of any help, the Webpack template for Vue dropped |
Although, this is what I'm also experiencing with Sadly, that's a webpack loader. |
I am trying to get isparata to work with vue.js, so i can see code coverage of the scripts of my vue.js components.
However, this doesn't seem possible: My loader in my Karma config file looks like the following:
which produces a code coverage report that looks like this:
How can I get the vue-loader to only pass back the source map to isparata?
The text was updated successfully, but these errors were encountered: