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
Relative sourceRoot can cause issues with file discovery #99
Comments
I think the correct code here would be:
Where I'll need to test this though to make sure I'm not just fixing this case. |
Agreed - it looks like the bug is due to const candidatePath = join(sourceRoot, sourcePath)
if (isAbsolute(candidatePath)) {
this.path = candidatePath
} else {
- this.path = resolve(dirname(this.path), sourcePath)
+ this.path = resolve(dirname(this.path), candidatePath)
} |
The following is a legal sourceMap. Note the condition that causes a problem, is the combination of a relative
sourceRoot
along with asources
member that contains a path that an additional level deep in the directory structure. In this case,subdir/foo.ts
.Give the discovery of a covered file in c8 that was
[somepath]/rootdir/subdir/foo.js
when we attempt to resolve the location of the source file we will hit this block of code: https://github.com/istanbuljs/v8-to-istanbul/blob/master/lib/v8-to-istanbul.js#L79 we will end up creating a path that is:[somepath]/rootdir/subdir/subdir/foo.ts
which is invalid.Taking a look at this for a PR.
The text was updated successfully, but these errors were encountered: