Comparing version 5.5.0 to 5.6.0
## Change Log | ||
### v5.6.0 (2016/02/03 +7:00) | ||
- [#159](https://github.com/bcoe/nyc/pull/159) skip should continue working with source-maps (@novemberborn) | ||
- [#160](https://github.com/bcoe/nyc/pull/160) don't instrument files outside of the current working directory (@novemberborn) | ||
### v5.5.0 (2016/01/24 +07:00) | ||
@@ -4,0 +9,0 @@ |
11
index.js
@@ -183,6 +183,7 @@ /* global __coverage__ */ | ||
NYC.prototype.shouldInstrumentFile = function (filename, relFile) { | ||
relFile = relFile.replace(/^\.\//, '') // remove leading './'. | ||
// Don't instrument files that are outside of the current working directory. | ||
if (/^\.\./.test(path.relative(this.cwd, filename))) return false | ||
return (!this.include || micromatch.any(filename, this.include) || micromatch.any(relFile, this.include)) && | ||
!(micromatch.any(filename, this.exclude) || micromatch.any(relFile, this.exclude)) | ||
relFile = relFile.replace(/^\.[\\\/]/, '') // remove leading './' or '.\'. | ||
return (!this.include || micromatch.any(relFile, this.include)) && !micromatch.any(relFile, this.exclude) | ||
} | ||
@@ -195,4 +196,4 @@ | ||
glob.sync('**/*.js', {nodir: true, ignore: this.exclude}).forEach(function (filename) { | ||
var obj = _this.addFile(filename) | ||
glob.sync('**/*.js', {cwd: this.cwd, nodir: true, ignore: this.exclude}).forEach(function (filename) { | ||
var obj = _this.addFile(path.join(_this.cwd, filename)) | ||
if (obj.instrument) { | ||
@@ -199,0 +200,0 @@ module._compile( |
@@ -78,3 +78,3 @@ var path = require('path') | ||
return { | ||
var mapped = { | ||
start: { | ||
@@ -87,5 +87,8 @@ line: start.line, | ||
column: end.column | ||
}, | ||
skip: location.skip | ||
} | ||
} | ||
if (location.skip === true) { | ||
mapped.skip = true | ||
} | ||
return mapped | ||
} | ||
@@ -130,10 +133,14 @@ | ||
Object.keys(fileReport.fnMap).forEach(function (k) { | ||
var mapped = mapLocation(sourceMap, fileReport.fnMap[k].loc) | ||
var item = fileReport.fnMap[k] | ||
var mapped = mapLocation(sourceMap, item.loc) | ||
if (mapped) { | ||
f[index + ''] = fileReport.f[k] | ||
fnMap[index + ''] = { | ||
name: fileReport.fnMap[k].name, | ||
name: item.name, | ||
line: mapped.start.line, | ||
loc: mapped | ||
} | ||
if (item.skip === true) { | ||
fnMap[index + ''].skip = true | ||
} | ||
index++ | ||
@@ -140,0 +147,0 @@ } |
{ | ||
"name": "nyc", | ||
"version": "5.5.0", | ||
"version": "5.6.0", | ||
"description": "a code coverage tool that works well with subprocesses.", | ||
@@ -96,3 +96,3 @@ "main": "index.js", | ||
"sinon": "^1.15.3", | ||
"source-map-fixtures": "^0.4.0", | ||
"source-map-fixtures": "^2.1.0", | ||
"source-map-support": "^0.4.0", | ||
@@ -99,0 +99,0 @@ "split-lines": "^1.0.0", |
38304
669