istanbul-lib-source-maps
Advanced tools
Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
@@ -9,8 +9,3 @@ /* | ||
fs = require('fs'), | ||
isAbsolute = function (p) { | ||
if (path.isAbsolute) { | ||
return path.isAbsolute(p); | ||
} | ||
return path.resolve(p) === path.normalize(p); | ||
}, | ||
pathutils = require('./pathutils'), | ||
sourceStore = require('./source-store'), | ||
@@ -64,3 +59,3 @@ transformer = require('./transformer'), | ||
} | ||
var dir = path.dirname(transformedFilePath), | ||
var dir = path.dirname(path.resolve(transformedFilePath)), | ||
file = path.resolve(dir, sourceMapUrl); | ||
@@ -100,6 +95,6 @@ this.data[transformedFilePath] = { type: 'file', data: file }; | ||
} | ||
if (isAbsolute(filePath)) { | ||
if (pathutils.isAbsolute(filePath)) { | ||
return fs.readFileSync(filePath, 'utf8'); | ||
} | ||
return fs.readFileSync(path.resolve(that.baseDir || process.cwd(), filePath), 'utf8'); | ||
return fs.readFileSync(pathutils.asAbsolute(filePath, that.baseDir)); | ||
}; | ||
@@ -131,5 +126,6 @@ | ||
smc.sources.forEach(function (s) { | ||
var content = smc.sourceContentFor(s); | ||
var content = smc.sourceContentFor(s), | ||
sourceFilePath = pathutils.relativeTo(s, filePath); | ||
if (content) { | ||
that.sourceStore.registerSource(s, content); | ||
that.sourceStore.registerSource(sourceFilePath, content); | ||
} | ||
@@ -136,0 +132,0 @@ }); |
@@ -7,3 +7,4 @@ /* | ||
var libCoverage = require('istanbul-lib-coverage'), | ||
var pathutils = require('./pathutils'), | ||
libCoverage = require('istanbul-lib-coverage'), | ||
MappedCoverage = require('./mapped').MappedCoverage; | ||
@@ -17,3 +18,3 @@ | ||
*/ | ||
function getMapping(sourceMap, location) { | ||
function getMapping(sourceMap, location, origFile) { | ||
@@ -53,3 +54,3 @@ var start = sourceMap.originalPositionFor(location.start), | ||
return { | ||
source: start.source, | ||
source: pathutils.relativeTo(start.source, origFile), | ||
loc: { | ||
@@ -80,3 +81,3 @@ start: { | ||
hits = fc.s[s], | ||
mapping = getMapping(sourceMap, loc), | ||
mapping = getMapping(sourceMap, loc, fc.path), | ||
mappedCoverage; | ||
@@ -94,4 +95,4 @@ | ||
hits = fc.f[f], | ||
mapping = getMapping(sourceMap, fnMeta.decl), | ||
spanMapping = getMapping(sourceMap, fnMeta.loc), | ||
mapping = getMapping(sourceMap, fnMeta.decl, fc.path), | ||
spanMapping = getMapping(sourceMap, fnMeta.loc, fc.path), | ||
mappedCoverage; | ||
@@ -117,3 +118,3 @@ | ||
for (i = 0; i < branchMeta.locations.length; i += 1) { | ||
mapping = getMapping(sourceMap, branchMeta.locations[i]); | ||
mapping = getMapping(sourceMap, branchMeta.locations[i], fc.path); | ||
if (mapping) { | ||
@@ -120,0 +121,0 @@ if (!source) { |
{ | ||
"name": "istanbul-lib-source-maps", | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "Source maps support for istanbul", | ||
@@ -5,0 +5,0 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59054
16
1555