nuxt-ava-e2e-unit-testing
nuxt-ava-e2e-unit-testing copied to clipboard
Istanbul code coverage line number
Hi,
When execute npm run test:unit, here is the following result :
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 86.36 | 70.45 | 83.33 | 86.36 | |
Logo.vue | 100 | 89.47 | 100 | 100 | 5,12 |
Todo.vue | 80 | 56 | 80 | 80 |... ,68,89,120,126 |
----------|----------|----------|----------|----------|-------------------|
Problem :
The Logo.vue isn't coverage in branch at 100% because there are some missing conditionnals states according to Istanbul.
I check on my project, and get the same strange thing : uncovered line are totally incorrect.
In this example, line 5 at Logo corresponding to html class.
Another example, Todo.vue : uncovered line 120, 126 ... but there are only 73 line in this file :/
How to resolve this ? I try to follow this https://stackoverflow.com/questions/44120502/nyc-coverage-shows-incorrect-line-numbers. But i got this error : Module not found : babel-register
Thanks for your help :) Thanks for this repository to start with NuxtJs and Ava :)
Have you tried doing npm i babel-register ?
babel-register is for babel 6 whereas @babel/register is for babel 7 AFAIK.
need to figure out which tool uses babel 6 (which in turn requires the old babel-register plugin)
Hi @vinayakkulkarni ,
Thanks for your answer.
I try babel-register for babel 6 and change nyc, ava, and babel configuration. But always the same result like i printed before :(
I don't understand why Istanbul detect this line ... a really mystery for me :/ If you have another idea ? Probably a problem of the configuration ? Or maybe i miss something ?
I try to continue to fix this problem and i found an answer :
When webpack uses inline-source-map, nyc don't works correctly..
I try many possibilities to fix this but no results :( Do you have maybe a solution ?
Thanks :) Regards.