Comparing version 0.3.7 to 0.3.8
@@ -6,2 +6,12 @@ Changelog | ||
<tr> | ||
<td>v0.3.8</td> | ||
<td> | ||
<ul> | ||
<li>Fail check coverage command when no coverage files found, thanks to @nexus-uw</li> | ||
<li>handle relative paths in check-coverage, thanks to @dragn</li> | ||
<li>support explicit includes for cover, thanks to @tonylukasavage</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>v0.3.7</td> | ||
@@ -8,0 +18,0 @@ <td> |
@@ -17,2 +17,8 @@ /* | ||
if (!path.isAbsolute) { | ||
path.isAbsolute = function(file) { | ||
return path.resolve(file) === path.normalize(file); | ||
}; | ||
} | ||
function CheckCoverageCommand() { | ||
@@ -28,7 +34,11 @@ Command.call(this); | ||
files.forEach(function (file) { | ||
filesObj[path.join(root, file)] = true; | ||
filesObj[file] = true; | ||
}); | ||
Object.keys(covObj).forEach(function (key) { | ||
if (filesObj[key] !== true) { | ||
// Exclude keys will always be relative, but covObj keys can be absolute or relative | ||
var excludeKey = path.isAbsolute(key) ? path.relative(root, key) : key; | ||
// Also normalize for files that start with `./`, etc. | ||
excludeKey = path.normalize(excludeKey); | ||
if (filesObj[excludeKey] !== true) { | ||
obj[key] = covObj[key]; | ||
@@ -110,2 +120,5 @@ } | ||
if (err) { throw err; } | ||
if (files.length === 0) { | ||
return callback('ERROR: No coverage files found.'); | ||
} | ||
files.forEach(function (file) { | ||
@@ -112,0 +125,0 @@ var coverageObject = JSON.parse(fs.readFileSync(file, 'utf8')); |
@@ -29,2 +29,3 @@ /* | ||
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns e.g. "**/vendor/**"'), | ||
formatOption('-i <include-pattern> [-i <include-pattern>]', 'one or more fileset patterns e.g. "**/*.js"'), | ||
formatOption('--[no-]default-excludes', 'apply default excludes [ **/node_modules/**, **/test/**, **/tests/** ], defaults to true'), | ||
@@ -62,2 +63,3 @@ formatOption('--hook-run-in-context', 'hook vm.runInThisContext in addition to require (supports RequireJS), defaults to false'), | ||
'preload-sources': Boolean, | ||
i: [ Array, String ], | ||
'include-pid': Boolean | ||
@@ -149,3 +151,3 @@ }, | ||
root: config.instrumentation.root() || process.cwd(), | ||
includes: [ '**/*.js' ], | ||
includes: opts.i || [ '**/*.js' ], | ||
excludes: excludes | ||
@@ -152,0 +154,0 @@ }, |
@@ -10,3 +10,2 @@ /* | ||
path = require('path'), | ||
SEP = path.sep || '/', | ||
fs = require('fs'), | ||
@@ -311,2 +310,3 @@ util = require('util'), | ||
function cleanPath(name){ | ||
var SEP = path.sep || '/'; | ||
return (SEP !== '/') ? name.split(SEP).join('/') : name; | ||
@@ -313,0 +313,0 @@ } |
{ | ||
"name": "istanbul", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale", | ||
@@ -51,3 +51,6 @@ "keywords": [ "coverage", "code coverage", "JS code coverage", "JS coverage" ], | ||
"Justin Johnson @booleangate", | ||
"Juan Gabriel Jiménez @juangabreil <juangabreil@gmail.com>" | ||
"Juan Gabriel Jiménez @juangabreil <juangabreil@gmail.com>", | ||
"Daniel Sabelnikov @dragn <dsabelnikov@gmail.com>", | ||
"Tony Lukasavage @tonylukasavage <anthony.lukasavage@gmail.com>", | ||
"Simon Ramsay @nexus-uw" | ||
], | ||
@@ -54,0 +57,0 @@ "scripts": { |
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
292495
6341