-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Wrong absolute path with .vue files #464
Comments
I ran into the same problem |
Any update on this issue? |
@ejaz47 , Maybe this link can help you https://gist.github.com/lsapan/3bfd0ffc0fb3d4a036fce84f6eea142e. |
This strikes me as possibly an issue with the source-maps being generated. If src/Component.vue has a source-map that refers to I'm leaving this issue open so it can be discussed and hopefully a solution can be found but I don't really know vue so I don't think I can help. |
Hello i don't know if issue is due by error in generation of source-maps in vue or if is an error in pathutils. Source map it's build like this: {
"source": ["file.vue"],
"sourceRoot": ["/src/components/" ]
} SourceMapConsumer build this in sources: it's okay but if filePath is absolute file of file.vue and source is relative path of file.vue why build path with A solution can be add conditions like this to solve problem if (origFile.indexOf(file) !== -1) {
return origFile
}
Edit: The SourceMapConsumer result ( istanbuljs/packages/istanbul-lib-source-maps/lib/pathutils.js Lines 16 to 20 in 025e8af
Since the relative path seems to be built from the root of project why not replace |
From what I can tell the changes being requested here would break projects that construct correct source-maps. Can someone commit generated files to a git repo so I can browser the files that are generated? This would allow me to be very specific and say exactly what is wrong with the example source-map. No archives please. |
Ok so if i understand correctly, good practice would be that sourceRoot is an absolute path to obtain |
Hi, I'm having an issue with HTML report saying "Unable to lookup source", and this is specific to .vue files. I have created a repo to demonstrate it: https://github.com/riophae/istanbuljs-bug-reproduction
You can download the repo as a ZIP and see it in action (located in
test/coverage/index.html
).If you take a closer look, you see there are duplications in the path
src/src/Component.vue
, which should besrc/Component.vue
if correctly determined.After hours of diving in the source code of InstanbulJS packages, I found the path manipulation that causes the bug happens there:
istanbuljs/packages/istanbul-lib-source-maps/lib/get-mapping.js
Line 168 in 025e8af
For the
src/Component.vue
file mentioned above, the values ofstart.source
andorigFile
are"src/Component.vue"
and"/mnt/c/Projects/istanbuljs-bug-reproduction/src/Component.vue"
respectively.istanbuljs/packages/istanbul-lib-source-maps/lib/pathutils.js
Lines 16 to 20 in 025e8af
You see
"src/Component.vue"
as thefile
argument is not an absolute path. So the result returned bypathutils.relativeTo()
becomes"/mnt/c/Projects/istanbuljs-bug-reproduction/src/src/Component.vue"
, resulting in the duplications.I don't know why the
file
argument here is not an absolute path. Maybe this is also related to vue-loader that I've used to process .vue files.Any ideas? Thanks.
Related issues:
The text was updated successfully, but these errors were encountered: