tankjs-coverage
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -12,6 +12,16 @@ /** | ||
var coverNodeModules = process.env.COVER_NODE_MODULES === 'on'; | ||
var coverNodeModules = process.env.cov_all , coverDepth = 0; | ||
if (coverNodeModules) { | ||
if (/^\d+$/.test(coverNodeModules)) { | ||
coverDepth = +coverNodeModules; | ||
coverNodeModules = false; | ||
} else { | ||
coverNodeModules = true; | ||
} | ||
} else { | ||
coverNodeModules = false; | ||
} | ||
// Current coverage information | ||
var files = {}, ignored = {}; | ||
var files = {}; | ||
@@ -25,4 +35,8 @@ exports.requestHandler = function (req, res) { | ||
Module.prototype._compile = function (content, filename) { | ||
if ((coverNodeModules || filename.indexOf('node_modules') === -1) && !ignored[filename]) { | ||
content = addCoverage(this, filename, content); | ||
var m; | ||
switch (true) { | ||
case coverNodeModules: | ||
case filename.indexOf('node_modules') === -1: | ||
case coverDepth && (m = filename.match(/([\/\\])node_modules\1/g)) && m.length <= coverDepth: | ||
content = addCoverage(this, filename, content); | ||
} | ||
@@ -129,3 +143,3 @@ $_compile.call(this, content, filename); | ||
case 'DoWhileStatement': | ||
console.log(stmt); | ||
// console.log(stmt); | ||
testBlock(stmt.body); | ||
@@ -132,0 +146,0 @@ point = stmt.range[1]; |
{ | ||
"name": "tankjs-coverage", | ||
"version":"0.1.0", | ||
"version": "0.2.0", | ||
"master": "master.js", | ||
@@ -8,7 +8,8 @@ "args": { | ||
"desc": "show code coverage", | ||
"commands": ["start", "restart"] | ||
"commands": ["start", "restart", "test"] | ||
}, | ||
"--cov_all": { | ||
"desc": "show code coverage (including code in node_modules)", | ||
"commands": ["start", "restart"], | ||
"demo": "{n}", | ||
"desc": "show code coverage (including code in node_modules). assign a value to specify how many node_modules could a module path contain", | ||
"commands": ["start", "restart", "test"], | ||
"bind_env": "cov_all" | ||
@@ -31,3 +32,5 @@ } | ||
"disable": "tankjs-cluster", | ||
"priority": 100 | ||
"priority": 100, | ||
"repository": "https://github.com/Clouda-team/tankjs-coverage.git", | ||
"author": "kyriosli" | ||
} |
@@ -26,6 +26,8 @@ (function () { | ||
fileNames = Object.keys(files); | ||
var preLen = fileNames[0].lastIndexOf('/') + 1, pre = fileNames[0].substr(0, preLen); | ||
var preLen = fileNames[0].lastIndexOf('/') + 1 || fileNames[0].lastIndexOf('\\') + 1 , pre = fileNames[0].substr(0, preLen); | ||
fileNames.forEach(function (fileName) { | ||
while (fileName.substr(0, preLen) !== pre) { | ||
pre = pre.substr(0, --preLen); | ||
console.log('trim pre to', pre); | ||
} | ||
@@ -32,0 +34,0 @@ }); |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
141807
0
3517
2